[New FREE plugin] Session & Local Storage (web storage API)

That is, the Bubble programmer must tell us what type of field we are to use.

So, even though we can have a plugin input that is “any thing”, we can never know how to publish that value, unless we ask the Bubble programmer what type it should be. It’s a minor limitation, but it can be annoying (for reasons I omit here at the moment).

Yup sorry for the confusion. That is exactly what I meant. Type navigation inevitably requires programmer input.

I have written some seriously messed up nested parameterized type methods in Julia. paramertized type paramertized by array type paramertized by number types paramertized by…" Generally resulting in a “I can’t believe that compiled and ran” moment.

1 Like

Yeah I’ve mulled over implementing a plugin for local/session storage but the idea always makes my skin crawl. I think what really gets under my skin about using local/session storage in Bubble is that whatever use case a developer thinks they are solving with local/session storage it is probably better addressed with more native Bubble techniques. Such as custom states.

My take on the MDN documentation for local/session storage was that it was intended for building things like client side spreadsheets. So in the context of Bubble, a plugin developer would use it discretely behind the scenes to manage more complex semi-persistent state. A possible use case is a plugin that can “resume where you left off” on returning to the page after navigating around the app, i.e. unsaved (to the DB) data in a text editor (partial answers to quizzes and tests, maybe?). Or sinlgeton/monadic plugin elements where there can be multiple copies on the page but they all mirror each other via the local/session storage, rather than polluting the global/window object.

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

Yeah I can see it being useful for a multi-step reversible on-boarding/account creation wizard, where we only want to commit once all the validations have passed. Even then I would probably just bite the bullet and write an app specific custom plugin for exactly that purpose, likely using the non-persistent session storage, and with an “Account Creation” element containing states along the lines of “Step 1 Data”, “Step 2 Data”, etc… It would be a bit fluffed up in terms of a code base, but the control over the type coercion in and out of storage would be much tighter.

hello
I have the same problem
Did you find the way to fix it ?
@Benji can you help ?
Thank you in advance

@caeroa
Any idea on this ? I want to store list of items(JSON format response) in a local storage and access them as it is on other pages. I have tried with single item but not fetching exact data back.

Any hel is appreciated.

1 Like

Have you used webstorage plugin for list of values ?