I’m running into an issue with custom states and database objects. I want to retrieve a list of items (data type Item) from the database and store them in a custom state. The idea is that users can modify these items locally but the changes should only be saved when they click a “Save Changes” button.
However, I’ve noticed that as soon as I modify an item in the custom state, it immediately updates the database. This seems to be happening because custom states only store a reference to the original database object instead of creating a true copy.
Is there a way to load database objects into a custom state and modify them locally without affecting the database immediately?
What I would do if I were you would be to only change the fields of the item once the button “save” has been clicked. There is no way to change an Item locally.
There’s no way in Bubble to modify a ‘thing’ independently of its existence in the database.
A ‘Thing’, by definition, is a database object, and any reference to it elsewhere is just that (i.e. a reference to the database object) - so making changes to a Thing ALWAYS updates the database.
If you really need to make changes locally then you’ll have to create a local version of it (using javascript), make change to that (using javascript) and then you can pass that into t backend workflow (as JSON) and update the Thing(s) there based on that.