I have an app with several screens. The latter screens save variables to the local storage. When the last screen loops back to the first screen it load the variables fine.
If there are no variables saved which will only happen on the 1st run, then I would like to store default values. Right now, I depend on loading the variables from local storage and if there are none, then my screen won’t display properly until the user navigates once around through all the screens.
It seems necessary, that I have to download the app first before I can test these functions and I am also wondering if the new installation uses the previous install’s local storage or are they completely deleted when I uninstall the previous attempt and download again?
Actually, I think there is some kind of bug in Thunkable. I did some tests and get funny results. Maybe the Thunkable developers can have a look at it?
Test1:
Label1 shows “null”, which I would expect, since var1_key does not exist in local storage
Test2:
Here I would expect that Label1 shows “Default for variable 1”, but this is not the case. Label1 shows “null” again.
Test3:
Here the label shows “NOT null”
To me it seems that testing for null doesn’t work. The first two tests show that apparently null is returned if the key does not exist in local storage. However, testing for null does not work.
(BTW, I also tried it the other way around, so test for value=null, and swapping the do and else parts. Same result)
The “null” block has an object type, which makes it difficult to compare with it. For the correct comparison with the string “null”, the null block must be cast to a string type, adding it via “join”.