@alex.stanescu thank you very much for your attention to this issue. As @jared.gibb also notes, there is scant guidance for plugin developers. And, when we need to solve technical challenges with creating Bubble plugins, we often have to resort to a process of inspection and deduction to solve those.
What happened here is a really good example. The “official API” (the skimpy and not 100% correct “documentation” (which is really just help text) that appears in the plugin editor), tells us (of List objects) that “you can do .length()
on it and you can do .get()
on it”.
Similarly, it basically tells us of Things that “you can do .listProperties()
on it and you can do .get()
on it”.
The docs tell us nothing, BTW, about API response objects and anything we know about those we know via inspection and deduction.
So, since I have plugins that deal with Lists and are designed to work with any type of data we might receive from Bubble (and, similarly, publish such data back to Bubble from the plugin). I have had to work out entirely for myself ways of handling all that.
And one thing that has been true for years now is that the various types of Bubble objects that we must handle is that if we Object.getOwnPropertyNames()
on them, we see those methods as properties and now we tell them apart.
So (for example), we have a need to know in some function if some object my_list
(something we expect to be array-like) is a JavaScript array or if it’s a Bubble List object (which we can turn into an array). How can we tell them apart in a generic programmatic way? Well, they are both of type object. Now, we can identify my_list
as an array if Array.isArray(my_list)
.
But now what if my_list
fails that test? What the heck is it? We need to ensure it is what we expect it to be (a Bubble List object) before we attempt to .get() on it. How the hell else would one do this except something like:
my_list.hasOwnPropertyName('get') && my_list.hasOwnPropertyName('length') && my_list.get(0, my_list.length())
We MUST have a way to do this if we expect to write solid code, right, @alex.stanescu?
If get and length are NOT exposed as properties, how on earth are we to do this?
Further, I am still at a loss to understand how Bubble engineers would not understand this need and that removing those things as properties is a good idea.
The above is a serious question, by the way. If in the new world where a List exposes _pointer,_call_metadata
what am I supposed to do to check for the existence of the get
and length
before trying .get
??? I know of only way in JavaScript… .hasOwnProperty()
but maybe I’m a dumb-dumb.
I was going to go on and explain how we differentiate between Things and API response objects and other generic objects, but you know where I’m going with that and I seriously need a response to the question above.