From 727a6d397595b806776a8789a8b201e486796ad2 Mon Sep 17 00:00:00 2001 From: Daniel Ternyak Date: Sun, 2 Jul 2017 12:55:58 -0500 Subject: [PATCH] Keep redux state across hot module reloads --- common/index.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/index.jsx b/common/index.jsx index 3f4d9555..334c95c4 100644 --- a/common/index.jsx +++ b/common/index.jsx @@ -15,10 +15,10 @@ import notificationsSaga from './sagas/notifications'; import 'assets/styles/etherwallet-master.less'; const sagaMiddleware = createSagaMiddleware(); +let store; const configureStore = () => { let sagaApplied = applyMiddleware(sagaMiddleware); - let store; let middleware; if (process.env.NODE_ENV !== 'production') { @@ -54,5 +54,7 @@ const renderRoot = Root => { renderRoot(Root); if (module.hot) { - module.hot.accept(); + module.hot.accept('reducers/index', () => + store.replaceReducer(require('reducers/index').default) + ); }