-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange reference values when using new svelte-persistent-store. #24
Comments
The This value shouldn't be "visible" when using the store. It only appear in the saved data. So normally if you log the content of the store you shouldn't see it, but if you look at the content of your browser SessionStorage you should see it. BTW, you can use |
I have noticed though that my entire app breaks in this case because I rely on a lot of data checking to see if a field or object etc is empty or filled to manipulate the UI/UX... and because of these 'values' they're actually responding with fake information... i.e. a simple
... will return false on an object with the '#$@__reference__0' inside. |
I am also seeing these references and my store is still a string when I am accessing it. I think there is something timing wise happening -- maybe when there is a large amount of data to deserialize? |
Do you have a reproduction repository (or a stackblitz or similar) so I can check it ? |
sorry, I have moved my code to dexie.js and am using that now but I suspect it was happening when I was loading a large json. Something I'm doing with dexie now is awaiting an init fn in my store that resolves after the stores have been populated so I won't encounter a similar condition |
@brianorwhatever I had the same issue. The https://github.com/MacFJA/svelte-persistent-store/blob/main/.docs/How-To/06-Change-Serialization.md @MacFJA thanks for the easy copy/paste samples you provided in the link above. |
Same here. Able to resolve the issue by using JSON for serialization. But I don't know if there will be any drawback of using JSON instead of the default one. |
Each serializer have they own benefits and drawbacks
For every Serializer that are not JSON, the output can be harder to read, it need to be deserialized with the same logic, output is often larger (as more data is need to save complete information) for some simple structure Footnotes
|
I just transitioned an old project to a new version of Svelte, with .TS and all the other upgrades I can think of., and I'm getting unusual references in my localStorage and sessionStorage instead of actual data.
This is my store.ts
When I look at the values of everything, transitionUser, user, and error, are all
["#$@__reference__0"]
For some reason, signupConfirm, passwordReset, and mfa are all fine. Not sure what's going on here.
The text was updated successfully, but these errors were encountered: