How does Local Storage work in Bubble.io

Sure @tylerboodman: What I mean is that

(1) the only support for createable/updateable/modifyable objects we have in Bubble are Things (caveat - API response objects are Thing-like but suffer from the same sort of issues as Things)

(2) Things only exist in the context of the database (creating a new Thing requires interaction with the database, a Thing cannot be created purely server-side, and there is no way for us to create an object that is like a Thing in a plugin and bring it back into Bubble as something that the Bubble programmer can easily deal with.

(3) Somewhat related is the fact that there is no client-side action for creating multiple Things at once (there’s no “Create a List of Things”)…

So, in the case of a shopping cart where a user is selecting some items and their quantities, if I don’t want to organize them into Things yet, I wind up with parallel lists: a list of items (which are probably already Things of course) and a list of numbers with represents the quantities (I might additionally have other lists such as a list of discounts or tax rates or whatnot).

If I want to pass those values now to some other page, we could do it with URL parameters, but vanilla Bubble doesn’t expect array values here so we would have to parse them ourselves (this was the point of Floppy Rehydrator, you might recall). Also, those URLs are gonna be pretty ugly, so browser storage using Floppy/Floppy Reader is a more elegant solution.

Regardless of whether I pass/store/retrieve those values somewhere else than the original shopping cart page, what we then have to do is turn them into objects we can work with (Things) and so typically we would then pass those “parallel lists” of values to a recursive backend workflow that converts them into things (e.g., make an order, take the first set of values and make a line item, attach the new line item to the order, recurse to make the rest of the line items, then process the resulting order (whatever business logic your app requires).

That recursion is made much easier using my List Popper plugin and this is demonstrated in the video I linked to before. (Also, most of the preceding issues are discussed – except for browser storage – in the video I linked, which I’m gonna paste again below.)

Instead of a recursive backend workflow, we might instead use the bulk create API endpoint to create our desired Things, but this is a bit of a pain to set up (I had been thinking of making a little plugin that makes that a bit simpler for folks, but whenever I start on that I get grumpy about the interface – we can make it a bit simpler, but can’t entirely make it hassle-free to the Bubble programmer).

Anyway, here’s the video about shopping carts that I’m referring to (I posted the wrong link before):

And here’s the thread I meant: 📒 What is the best way to publish a list of objects to bubble? - #10 by keith

3 Likes