-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Persisted observable returns undefined during initial render #448
Comments
Yes, it's because AsyncStorage is async. If you want a synchronous persistence you could use the MMKV plugin or the new kv-store plugin which is in the latest version but not yet documented. Details are here: #444 |
Thanks @jmeistrich, new expo-sqlite kv store works great, thought there's a misleading error which I ended up fixing in my fork. Here's PR if you're open to contributions: https://github.com/LegendApp/legend-state/pull/449/files |
Oh thanks, not sure how that mistake got through there! |
Just released beta.26 with your PR, thank you! |
Hello,
Your library looks awesome! I'm trying it out to see if I could use it within my app, and I'm running into a tiny "issue".
When I use observable within my component:
I get
test$
isundefined
during the initial render (app launch).I'd like to avoid getting undefined on initial render if possible. is that possible to achieve?
This is how my
test$
observable is defined:I'm assuming this is happening because I'm using AsyncStorage as my persistence layer?
I'm using
"@legendapp/state": "^3.0.0-beta.24",
withinreact-native
project.Thanks!
The text was updated successfully, but these errors were encountered: