redux-immutable-state-invariant
redux-immutable-state-invariant copied to clipboard
doesn't work with redux-devtools-extension
I use the following TypeScript code to setup Redux' middlewares: (Note: for dev purposes only)
if (typeof window !== 'undefined') {
if ((window as any).__REDUX_DEVTOOLS_EXTENSION__) {
enhancer = compose(
installReduxLoop(),
(window as any).__REDUX_DEVTOOLS_EXTENSION__({ trace: true, traceLimit: 25 }),
applyMiddleware(require('redux-immutable-state-invariant').default())
)
}
// ...
}
I have found that I need to comment out the call to __REDUX_DEVTOOLS_EXTENSION__(...)
in order for redux-immutable-state-invariant
to work properly, otherwise incorrect mutations are detected for everything. Perhaps a note could be added that the 2 middlewares/extensions are incompatible? Thanks.
If it helps, I've had success with the following setup that doesn't call REDUX_DEVTOOLS_EXTENSION directly:
import {applyMiddleware, compose, createStore} from "redux";
import myReducer from "./reducers/myReducer";
import {install} from "redux-loop";
import {default as installInvariant} from 'redux-immutable-state-invariant';
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
export const store = createStore(
myReducer,
{},
composeEnhancers(
applyMiddleware(
installInvariant()),
install()));
@j1m-renwick I tried the approach you suggested, but I am still getting the window is not defined.
event - compiled successfully
ReferenceError: window is not defined
at eval (webpack-internal:///./src/redux/store/configureStore.dev.js:18:26)
I'm sorry for the late reply. You can close this issue if you'd like.