Local storage broken?

Hey ! Since I am not yet familiar with the new variables, I’m still using localstorage and I have an issue :

I use this block when my screen opens :

image

This block is supposed to get the value from added and launch a procedure with this value, but the value is always = null

And this one when the button is clicked :

image

And this one fails to work as well because the value + 1 shows me NaN as there is no value in the localstorage.

How may I fix this please ? I tried doing this which works for all my other projects but it fails to work :confused:

image

Thanks !

Turns out the issue was the null string instead of image

@Mark, last time we talked about this you told me the string was the one to use, has it been updated ?

Thanks !

It is still the case that the LocalStorage component will return the string “null” as the value if there is no value associated with a key or if, for some reason, the non-string null value is stored at a key. If this doesn’t appear to be the case for you, please create a very simple project which shows the buggy behavior and share it.

Note that we will at some point probably start returning the null value rather than the “null” string from the LocalStorage component in order to be compatible with the way that variables get stored and retrieved but we haven’t done that yet. If you want to “future-proof” your blocks you might want to check for both:

40%20AM

-Mark

1 Like