fix(redux) fix not working with Redux Devtools

This commit is contained in:
Saúl Ibarra Corretgé 2022-03-28 10:16:01 +02:00 committed by Saúl Ibarra Corretgé
parent b7c68d09e7
commit 66153087e1
1 changed files with 3 additions and 13 deletions

View File

@ -218,19 +218,9 @@ export default class BaseApp extends Component<*, State> {
// additional 3rd party middleware:
// - Thunk - allows us to dispatch async actions easily. For more info
// @see https://github.com/gaearon/redux-thunk.
let middleware = MiddlewareRegistry.applyMiddleware(Thunk);
// Try to enable Redux DevTools Chrome extension in order to make it
// available for the purposes of facilitating development.
let devToolsExtension;
if (typeof window === 'object'
&& (devToolsExtension = window.devToolsExtension)) {
middleware = compose(middleware, devToolsExtension());
}
const store = createStore(
reducer, PersistenceRegistry.getPersistedState(), middleware);
const middleware = MiddlewareRegistry.applyMiddleware(Thunk);
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const store = createStore(reducer, PersistenceRegistry.getPersistedState(), composeEnhancers(middleware));
// StateListenerRegistry
StateListenerRegistry.subscribe(store);