-
Notifications
You must be signed in to change notification settings - Fork 866
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
redux-persist: persist timed out for persist key "root" at eval #786
Comments
Looks like I'm getting the same error, but it nothing is stored in the store. |
Upon further investigation looks like state is persisted only after timeout action is fired. Using react-boilerplate with switched off injected reducers and sagas and root Reducer state converted to simple object with Immutable in branches. Setup is the same as in the documentation. Could you please advise, @rt2zz ? |
Update from me @sinkovsky - I noticed it's the size of my |
I ran into this issue a couple of hours ago. Now everything is perfectly fine. In the hopes of helping what happened in my case here it is. I was working in the project and when ran outta battery in my mac so I just closed it and set aside yesterday. Today I just resumed working. And I remember the Android time mismatch warning was visible on my emulator. So lazy me just changed the clock setting and continued to work and that's when the issue popped up and I found this issue. I just ignored for the time being and kept working and when tired just shutdown my mac. Now again I started working everything fresh and the issue is no longer there. So I guess just restart app, emulator, bundler or PC and it'll just go away. |
I re-installed the app and the problem did not came back yet (for how long?) |
I'm having the same problem in Android |
I'm having the same problem on Android too |
i'm having the same problem in android |
setTimeout is started in So, I just disabled timeout in my configs
|
We have the same issue with React Native and AsyncStorage and setting timeout to |
const persistConfig = { timeout: null, |
Same here. Also chasing down an OOM bug, thinking the setTimeout could be responsible? Thoughts? |
I did everything and still getting the annoying error, any help please. My store as next: // Redux Persist config /const loggerMiddleware = createLogger({ const crashReporter = store => next => action => { const reducer = persistCombineReducers(config, reducers); const middleware = [thunk, logger, crashReporter]; const configureStore = (core, with_initials, lang, companies) => {
} const persistor = persistStore( return { persistor, store }; export default configureStore; ` |
I find this issue when setting an import { createStore } from 'redux';
import { persistStore, persistReducer } from 'redux-persist';
import { composeWithDevTools } from 'redux-devtools-extension';
import reduceReducers from 'reduce-reducers';
const initialState = { whatever: true };
const rootReducer = reduceReducers(initialState, ...someMagic);
const persistedReducer = persistReducer({ key: 'root', storage }, rootReducer);
const store = createStore(persistedReducer, composeWithDevTools());
const persitor = persistStore(store); Apparently, |
It's probably related to #189 or #226, but intriguingly in the client I was doing something like this: // Here my ReduxService class sets up everything
// Like in my previous reply, window.__PRELOADED_STATE__ would be initialState
const reduxService = new ReduxService(window.__PRELOADED_STATE__); After I did a spread like this, it started working as expected without the timeout issue. const reduxService = new ReduxService({...window.__PRELOADED_STATE__}); It is however behaving like in #226, though at this point in the code no actions are being sent (except for the @@init). I've been testing it and, although persist/PERSIST action is dispatched before persist/REHYDRATE, it's working for me. Mind you, I've created my own |
I had to set the |
Can you take a look at this issue? It happened two years |
Still happening now too, |
this package is not being maintained anymore as said in this reply. |
Just to be clear, I'm not affiliated with this project in any way, I was just observing that this package is clearly abandoned given the lack of activity. |
How do you fix issue about old state after updating some data. @Moumene |
Just my 2 cents here, but writing your own persist via async-storage is really pretty easy. Especially if you're waiting on updates to an abandoned package. Encrypted storage is a pretty cool package too if you're dealing with sensitive info |
Maybe exist alternative packages do you know? |
I faced the issue if I passed initial state like |
getting this same issue in 2024. |
You are right that there is not The problem here is that Changing the order here would fix the issue with timed out persist and would reveal the probleme in the developers code. I would also add a try catch block to console.error the error Here is a patch-package diff --git a/node_modules/redux-persist/lib/persistReducer.js b/node_modules/redux-persist/lib/persistReducer.js
index 1116881..9ce961b 100644
--- a/node_modules/redux-persist/lib/persistReducer.js
+++ b/node_modules/redux-persist/lib/persistReducer.js
@@ -70,8 +70,12 @@ function persistReducer(config, baseReducer) {
if (process.env.NODE_ENV !== 'production' && _sealed) console.error("redux-persist: rehydrate for \"".concat(config.key, "\" called after timeout."), payload, err); // only rehydrate if we are not already sealed
if (!_sealed) {
- action.rehydrate(config.key, payload, err);
_sealed = true;
+ try {
+ action.rehydrate(config.key, payload, err);
+ } catch (error) {
+ console.error("redux-persist: rehydrate for \"".concat(config.key, "\" failed"), error);
+ }
}
};
|
^ In this screenshot, my config key is 'tf' because I've been trying to debug this error, lol. But yeah, I only see this error in the redux logs for the persist/REHYDRATE action. It doesn't seem to be affecting the actual desired behavior of redux-persist, and I can't figure out why it's being thrown and how to get rid of it. I dug through the source and looks like @rt2zz fixed something in February that's nearby but not exactly the same thing. This error seemed to pop up out of nowhere for us.
Here's my setup. I wrote most of this originally pre-v5, then migrated to 5.0.0-proto and have been on that version since just now. This error happens for me both on 5.0.0-proto and after upgrading to 5.9.1.
Looking at the migration guide now makes me think some things aren't quite right in my code, even if those things are not connected to this error. I'm using getStoredState & persistStore differently. Hopefully someone can give some insight 🙏 .
store.js
Note: we're trying to do some manual cache invalidation up there by passing an empty obj to createStore if there's a new app version. Maybe there's a better way to do this. I wrote it back on 5.0.0-proto, and looking at it again I'm not sure why we needed to both a) pass an empty obj and b) call persistor.purge.
app.js, which calls createRehydratedStore and gets the app rendered
The text was updated successfully, but these errors were encountered: