Open adsalihac opened 4 months ago
Got the exact same issue. Using the latest expo release and start the dev for the web.
Got the exact same issue.
Using: "expo": "^51.0.9" "@react-native-async-storage/async-storage": "1.23.1" "redux-persist": "^6.0.0"
Here's a workaround if you are using something like Zustand:
// Zustand Store
{
...,
storage: createJSONStorage(() =>
Platform.OS === "web" ? localStorage : AsyncStorage
),
...,
}
localStorage ?
For those using supabase and seeing this in the stack trace too, check out https://github.com/supabase/supabase-js/issues/786
localStorage ?
@adsalihac
Yep, in web localStorage
it's simply the native solution. (No even need to import anything to use it)
At least, Zustand is able to deal with that seamlessly.
i am using redux with presist , it is support ? @t1gu1 , also what about Zustand , it is better than redux ?
@adsalihac Nope Redux is more complexe on that side. That being said, for you question I would 100% recommend Zustand if you just started your project!
We migrate all our project to use Zustand cause it's stupid easy to use and works really well! It makes look Redux over complicated for nothings.
what about state migration in zustand (like version update) , which zustand is using , official module right ?
it is possible to get data like this (store.getState()?.auth?.user) ?
@adsalihac Yes and yes. Just try it. ;)
Thank you @t1gu1
I think I encountered the same problem. can I help me,please
Using: "expo": "~51.0.8", "@react-native-async-storage/async-storage": "1.23.1", "zustand": "^4.5.2",
ios error message [ReferenceError: Can't find variable: localStorage]
Upgrade Expo package: (Just to be sure)
Where you create your Zustand store, simply add that for the storage: https://github.com/react-native-async-storage/async-storage/issues/1096#issuecomment-2148048977
Use AsyncStorage
for mobile and localStorage
for the web.
Confirmed the same issue use this code as workaround
if (Platform.OS === 'web') {
while (typeof window === 'undefined') {
await new Promise(resolve => setTimeout(resolve, 100));
}
}
For me it seems like this issue can be close.
I works fine now using only AsyncStorage
.
Feels like it was a Expo issue.
some issue here with 2.0.0 version
What happened?
Getting Error
Version
1.23.1
What platforms are you seeing this issue on?
System Information
Steps to Reproduce