I just upgraded my fully functional react-native app to Redux v4, but now I am getting the following error:
Error: Error: Error: Error: You may not call
In my project. This issue just popup from nowhere one day.
My solution: Disable the Chrome extension - Redux Devtools. Then everything is back to normal.
So with this kind of error, you should test in several browser to find the problem.
In my case the issue was not related to dev extension. I've encountered this error while working with deep-linking - was updating route query inside reducer. Wrapping logic related to manipulating url inside settimeout fixed the error.
I had the same error with a PWA build with polymer 3. The store.js also tried to use the redux dev tools which I had to deactivate:
...
// Sets up a Chrome extension for time travel debugging.
// See https://github.com/zalmoxisus/redux-devtools-extension for more information.
//const devCompose = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
const devCompose = compose;
// Initializes the Redux store with a lazyReducerEnhancer (so that you can
// lazily add reducers after the store has been created) and redux-thunk (so
// that you can dispatch async actions). See the "Redux and state management"
// section of the wiki for more details:
// https://github.com/Polymer/pwa-starter-kit/wiki/4.-Redux-and-state-management
export const store = createStore(
state => state,
devCompose(
lazyReducerEnhancer(combineReducers),
applyMiddleware(thunk))
);
...
This is what I did: Just commented the line for Chrome Redux Devtools Extension from my store.js file.
....
const store = createStore(
rootReducer,
initialState,
compose(
applyMiddleware(...middleware)
///This line--> window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
)
);
....
And the issue is just begun an hour ago. As we all know the extension is very handy during development, so let us wait for the real fix from the authorities.
Here's a couple of workaround while we wait for the fix...
Revert back to the working version v2.15.5 (For Chrome)
chrome://extensions
into the url and toggle on developer mode
on the top right
of the page.Load Unpacked
will appear. After clicking the button, select the extracted folder.Or just simply disable your redux-devtool extension for now.
FYI: this does not solve the OP's question but does solve the issue where developers are receiving the below error message starting 11/27/18.
Error: You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.
v2.16.2 has been released
For those who had previously disabled the extension, just re-enable it and Update your redux dev tools from 2.16.0 to 2.16.2 Update Redux Dev tools
In my case, I have to remove composeWithDevTools - a plugin for chrome
import { createStore, combineReducers, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
// const enhancer = composeWithDevTools(applyMiddleware(thunk))
const enhancer = applyMiddleware(thunk)
const store = createStore(reducers, enhancer);