Does Make Changes to a Thing not work on custom states?

I want to make changes to individual fields inside of a custom state, which is of type Example (for example :wink:). I tried to Make Changes to a Thing, and select the custom state as the thing. But alas, no changes were made. Should I assume then, that Make Changes to a Thing only works on DB objects and not custom states?

@keith maybe this is a job for Floppy (a plugin I’ve heard about, but haven’t yet fully explored?)

p.s. If helpful, the reason I’m trying to do this is because I have data coming in via API that’s the same schema as my Example data type. However, Bubble doesn’t see them as equivalent. Make Changes to a Thing was my attempt to assign the values of the API call to the custom state.

Yes

Use Set State action

1 Like

Thanks @boston85719 In my case, the API call is actually a mock API endpoint courtesy of the JSON Assistant plugin. So I’m not able to ā€œjustā€ set the custom state of Type A, when the mock API endpoint is of Type B. I guess I’ll just break out the Type A data type into its constituent fields, and assign the values that way…

Not what I would do…I would just use the plugin for all of what it is worth, which in this case is to use it to store the JSON and modify the JSON instead of bothering with custom states at all.

Ack, and appreciate the nudge.

@boston85719 For posterity’s sake, Toolbox offers a good way to ā€œconvertā€ from one data type to another. Specifically, the Javascript 2 Bubble element → Run Javascript action sends the unique ID(s) to the JS2B element, and JS2B publishes as the desired data type. As a singular item or a list.

Yes, this is similar to how that works for URL parameters as well. It is a single item search using the unique id that takes place in the background. It is also how a Do a Search with constraint of unique id = (unique ID value), so there is no real reason to use the toolbox plugin to send the unique ID via javascript and have the javascript to bubble element ā€˜convert’ it to the actual DB entry unless you are needing to send the value from a reusable element to a page or another reusable element.

What about latency? Meaning, with Toolbox I could run JavaScript and ā€˜convert’ asynchronously without blocking the UI thread. Meanwhile, ā€˜Do a Search’ would block the UI thread, and create real and/or perceived latency. No?

There is no difference. Toolbox doesn’t magically convert to the thing. It performs a do a search with constraint of unique ID, the same way as do a search. Both need to request from server for the database entry.

1 Like

Yup, get that. Based on my testing, however, Do a Search for unique ID blocks the UI thread, while aysnc Toolbox Run Javascript does not. (Specifically, Run JavaScript async → J2SB → publish value.) Even though both, as you point out, need to make a server call for the DB entry. Anyway… appreciate the conversation as always.

Okay, I think I understand what you are saying…basically if you use the do a search for thing, the user is not able to proceed until the search is complete, while the javascript approach doesn’t cause the user to need to wait for the search to complete in order to continue using the app.

Yup, that’s it!

1 Like

Huh? What ā€œlatencyā€ does a single search to a state vs a plugin search have? A call to a J2B element still runs code in it’s own instance. There’s no voodoo going on.

This topic was automatically closed after 70 days. New replies are no longer allowed.