Hello, I need help, I know that this can be easy for many of you, but I am starting to turn around.
I am building my first plugin and I am stuck in a step.
I am interested to access the information that I have in algolia.
But, I have a question, I already managed to connect, bring info from Algolia and everything easy from there there is already a lot of documentation. But on the bubble side, it has been difficult for me to understand the next step, which is to take the information of the object and be able to see it in some element and that is not console.log (the one that shows me that it brings it)
I did the @copilot course, but everything is understood perfectly, but it is not explained when it is an object or JSON or array, how I pass the info for example to a state?.
When I occupy instance.publishState (); it tells me this, âTrying to send an invalid array to Bubbleâ
thanks from chile
In general, I donât understand how to work with objects and pass them to a state.
Check out my non-edited video demonstrating this exact idea!
this was shot while riding in the back of a minivan on my way home from vacation. excuse the pauses, no voice over, and general feeling of âyeah the details are there but the video sucksâ
Hey! Youâre right, i hadnât read through that clearly so what i did was make another video!
check it out here!
Youâll define the state as an object using the API connector section of the plugin. Itâs a hack to make new data types. You must create your data type to return the object in the state.
You set the exposed state to be the data type (or data model) and now you can publish your object as youâd like
The issue is, you are trying telling the plugin editor your exposed state is a string when you are in fact passing it an array of objects. The editor is not smart enough to infer the object model.
You could publish several lists of values like this
let list1, list2
hits.forEach( elm => {
list1.push(elm.property1)
list2.push(elm.property2)
})
instance.publishState(âlist of strings 1â, list1)
instance.publishState(âlist of strings 2â, list2)
Or if you follow the videos I shared and define your response model in the api editor