Well, it’s most useful when you use it to store a complex object (think, an abandoned shopping cart). But it can be useful for just a single (scalar) value. Not a Bubble use case, but think of a page where the user submits some form and their email is the identifying key. And now, the page presents a second form and you don’t want the user to have to re-enter their email. So, you just save it to localStorage for when they return later. That’s a great use case for localStorage.

Similarly, localStorage could be used during a sign-in / onboarding workflow where you don’t want to bother saving (to the database) some values until the user completes the entire flow.

But making a (generally useful) Bubble plugin for any particular browser API is a pain in the butt as you have to consider all possible use cases (as much as you can) and accommodate them. This leads to rather large payloads even if some Bubble programmer is using the plugin in the most streamlined way.

It could also be useful as an alternative to passing values to some other page via querystring parameters. (What if the user simply never navigates to the next page? Their “saved” values are gone.)

It’s not very hard to do this, but the challenge is the UI for the Bubble programmer and providing useful feedback in the form of exposed states that are easy for the Bubble programmer to take action on. (My current draft of such a plugin is about 200 lines of [un-uglified/un-compled] JavaScript. Not bad.)

1 Like