Not compatible to redux 4.0.0
tsdevelopment opened this issue · 5 comments
tsdevelopment commented
The package can not be used with redux >= 4.0.0. Then I get the following error:
Dispatching while constructing your middleware is not allowed. Other middleware would not be applied to this dispatch.
peebles commented
Yep, I just hit this too.
peebles commented
import { createBrowserHistory } from 'history'
import { applyMiddleware, combineReducers, createStore } from 'redux'
import { connectRouter, routerMiddleware } from 'connected-react-router'
import { composeWithDevTools } from 'redux-devtools-extension';
import * as asyncInitialState from 'redux-async-initial-state';
import userReducer from './user';
export const history = createBrowserHistory();
const rootReducer = combineReducers({
user: userReducer,
asyncInitialState: asyncInitialState.innerReducer,
});
//const reducer = asyncInitialState.outerReducer( rootReducer );
const initialState = {
user: {}
};
const loadStore = ( getCurrentState ) => {
return new Promise( resolve => {
setTimeout( () => {
resolve({
...getCurrentState(),
user: { id: 'yyy', name: 'aqpeeb' }
});
}, 500 );
});
}
export const store = createStore(
asyncInitialState.outerReducer( connectRouter(history)(rootReducer) ), // new root reducer with router state
initialState,
composeWithDevTools(
applyMiddleware(
routerMiddleware(history), // for dispatching history actions
// ... other middlewares ...
asyncInitialState.middleware(loadStore),
),
),
);
mudovytskyi commented
Unfortunately, the problem is still waiting for a solving
peebles commented
I backed off to redux 3.6.something and I am cool now.