autoRehydrate doesn't working with hot reloading
See original GitHub issueThank you for this great library, I’m using it with RN for building an iOS app. I have noticed that if I apply the autoRehydrate() method in my configureStore.js that the hot reloading of iOS simulator won’t working, there’s any suggestion for this or if I can just remove the autoRehydrate(), if I do this will the redux-persist sill workable?
Here’s my configureStore.js :
/* @flow */
import { AsyncStorage } from 'react-native';
import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'remote-redux-devtools';
import thunk from 'redux-thunk';
import { persistStore, autoRehydrate } from 'redux-persist';
import rootReducer from '../reducers';
export default (onComplete?: () => void): any => {
const store = createStore(rootReducer, composeWithDevTools(
applyMiddleware(thunk),
autoRehydrate(),
));
if (module.hot) {
// $FlowFixMe
module.hot.accept(() => {
const nextRootReducer = require('../reducers').default;
store.replaceReducer(nextRootReducer);
});
}
persistStore(store, { storage: AsyncStorage }, onComplete);
return store;
};
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
[RN][Redux-Persist] AutoRehydrate is not a function
I am using redux-persist 5.5.0 When I debug my react native app, Error say "autoRehydrate is not a function" my source code here, ......
Read more >Hot reload - Flutter documentation
Hot reload doesn't work when enumerated types are changed to regular classes or regular classes are changed to enumerated types. For example: Before...
Read more >Write and debug code by using Hot Reload - Visual Studio ...
Hot Reload, similar to edit and continue, allows you to make changes to your code while running apps.
Read more >дэн on Twitter: "Frustrated by broken hot reloading in React ...
Six months ago the community told us Hot Reloading was a major pain ... Hot Reloading is not working · Issue #18899 ·...
Read more >Introducing Hot Reloading - React Native
Hot Reloading should work out of the box for the most common use cases. HMR Runtime. As we've seen before, sometimes it's not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Not sure it is
redux-devtoolsproblem, but you can disable recomputing actions there by settingshouldHotReloadtofalse:See more details in the devtools API.
@wellyshen I am not sure, in the past I have not enabled hot reload for reducers, only component tree. That said it should work, but I think may be complicated by the abstraction level that was chosen for autoRehydrate (a store enhancer). In reality a higher order reducer is sufficient and simpler.
Towards that effect, I would recommend you give https://github.com/rt2zz/redux-persist-state-manager a try. It is a higher order reducer which plays the same role as autoRehydrate and will soon be the recommended solution.