question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

useStoreRehydrated always returning true?

See original GitHub issue

For some reason useStoreRehydrated returns true even though it isn’t.

I’m using

const isRehydrated = useStoreRehydrated();
console.log('isRehydrated', isRehydrated);
if (!isRehydrated) return null;

to protect the App from loading until state is rehydrated.

But this console logs isRehydrated true even on the first run and I can see the App render with empty data and then rerender with rehydrated data a second later.

Not sure what to check next. Thanks for any help!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ctrlplusbcommented, Sep 20, 2022

Would be great if you could provide a repro. ♥️

Sorry we had to close old issues with inactivity in a movement towards centring ourselves with what is priority for the community. 👍

0reactions
jmyrlandcommented, Sep 20, 2022

I generally use easy-peasy with react-native apps using Expo, so I built a quick example using snacks.expo.dev instead of codesandbox.

Turns out it works now, at least with the default storage engine on web. 🥳 You can click the “No Errors” button at the bottom left to pull up the console logs. https://snack.expo.dev/@gollyjer/easy-peasy-rehydrate-bug

Thanks for your input! Good to see that the useStoreRehydrated hook works as expected now 🎉

This did lead to finding a bug when trying to use an alternative storage engine import ExpoFileSystemStorage from 'redux-persist-expo-filesystem';

I have another snack set up for that and will create a separate issue.

Thanks for taking the time - appreciate it 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

useStoreRehydrated always returning true? - - Bountysource
For some reason useStoreRehydrated returns true even though it isn't. I'm using const isRehydrated = useStoreRehydrated(); console.log('isRehydrated', ...
Read more >
Initial store data is components is always null , then loads + re ...
We are having a similar issue. When the size of the stored items increased above 5-6mb useStoreRehydrated this hook returns true before the ......
Read more >
useStoreRehydrated - Easy Peasy v5
import { useStoreRehydrated } from 'easy-peasy'; ... function App() { const rehydrated = useStoreRehydrated(); return ( <div> <Header ...
Read more >
Rehydration of store not working with redux-persist in react ...
Rehydration of redux-persist is not working for an unknown reason. Here is my config: const persistConfig = { key: 'root', ...
Read more >
Vegetarian friendly state for React | Frontend Utils library - kandi
returns a function that is used to store state ... setLoading(true) store.dispatch.reset(newState) store.dispatch.setLoading(false)
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found