You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my base layout I call the init method, and then in a component down the tree I call the store
// app/_layout.tsxinit()exportdefaultfunctionPage{
return ...
}// a component further down the treeexportdefaultfunctionUserCard(){const{ isReady, isLoggedIn, isOnboarded}=useAuth()console.log({isReady, isLoggedIn, isOnboarded});return ...
}
This is working fine, as the init method gets called first and I'm able to hydrate my store with some data (e.g I can retrieve the session from supabase and set isLoggedIn to true, that method pulls the data from the device's storage, no network call)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi
I'm having a weird behavior that I'm not really able to explain.
Using zustand with React Native and Expo
I have this store:
In my base layout I call the init method, and then in a component down the tree I call the store
This is working fine, as the init method gets called first and I'm able to hydrate my store with some data (e.g I can retrieve the session from supabase and set isLoggedIn to true, that method pulls the data from the device's storage, no network call)
But as soon as I introduce a network call like
none of the set() in my init() method seem to work. I do see the console.log for Here 2, but the state doesn't get updated.
the init method works well if I don't make any network call.
Is this specific to zustand where I'm using it wrong or is it related to react native/expo?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions