"Error: You may not call store.getState() while the reducer is executing." "Error: You may not call store.getState() while the reducer is executing." javascript javascript

"Error: You may not call store.getState() while the reducer is executing."


It's an issue with the new v2.16.0 release of redux-devtools-extension.

Here's a couple of workaround while we wait for the fix...

  1. Revert back to the working version v2.15.5 (For Chrome)

  2. Or just simply disable your redux-devtool extension for now.

    • either on the browser level or through your code(where you create the redux store)

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.


UPDATE

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);


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.