Skip to content
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

React Native - Android dev mode - rehydrated called after timeout #784

Closed
Noitidart opened this issue Apr 1, 2018 · 8 comments
Closed

Comments

@Noitidart
Copy link

This question is for other react-native devs on Android that come across this question.

Android dev mode is horrible with timeouts and event callbacks on proper time. Here is a quote:

https://github.com/archriss/react-native-snap-carousel#important-note-regarding-android

Android's debug mode is a mess: timeouts regularly desynchronize and scroll events are fired with some lag, .... On Android, you will experience issues with timeouts triggering when expected when JS Dev Mode is enabled, and you might have trouble with unreliable callbacks and loop mode when it isn't.

Due to this, while in dev mode only, I get:

redux-persist: rehydrate for "primary" called after timeout. Object { ... } undefined

And my whole store gets wiped out.

Do you react-native on android dev have any experience with a work around for this?

@jamsch
Copy link

jamsch commented Apr 5, 2018

Type adb shell date && date to figure out time discrepancies between the device and the computer. If the device is an emulator, reboot the emulator by holding the power button and re-opening the emulator.

AsyncStorage.get() often never resolves, especially after the first time you reload. This issue specifically has been ongoing for React Native -- facebook/react-native#14101 facebook/react-native#18372 facebook/react-native#12830

One thing you may want to try is changing the storage engine to redux-persist-filesystem-storage which may fix this issue.

@Noitidart
Copy link
Author

Oh wow thanks very much for that awesome reply!! Those linked issues are super helpful. It's ok I don't want to move to a seperate storage engine just for dev mode. This only happens in dev mode correct? (from my experience it seems so). If its not "just in dev mode" then for sure ill switch engine.

@jamsch
Copy link

jamsch commented Apr 5, 2018

In my experience it only occurs in remote debugging mode. I have quite a large production app running with the latest version of redux-persist using AsyncStorage on Android and there's been no problems so far besides not being able to effectively debug it while using the remote debugger.

@Noitidart
Copy link
Author

Sincerest thanks @jamsch for your replies!! Should I close this topic out do you think? I thought it would be helpful for people searching in redux-persist repo first as thats where the error is happening. But after seeing those issues it makes total sense to be in react-native repo's

@jamsch
Copy link

jamsch commented Apr 5, 2018

We can just leave the package maintainer to decide ;)

@Noitidart
Copy link
Author

Noitidart commented Apr 5, 2018

Haha good idea. Thanks again!! And major thanks to package maintainer for such a superb lib that is redux-persist!!

@kopax
Copy link

kopax commented Apr 13, 2018

@Noitidart Does it work well on react-native ? (iOS/Android) I can see many open issues regarding native, I am just not sure if it is that superb.
Thanks

@Noitidart
Copy link
Author

@kopax yeah it works perfectly on react-native. Just ignore the dev issue. Any issue that is easy to bear with can be overlooked. Simple restart of the app when it hangs is all it takes to fix dev. And its perfect in production.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants