KELiON/redux-async-initial-state

Trouble using enhancers router, thunk

Opened this issue · 2 comments

I have gotten this to work at a basic level. But, after I add router and thunk enhancers, I get the following error:

inputState.withMutations is not a function
TypeError: inputState.withMutations is not a function

Here is roughly my store:

    const reducer = asyncInitialState.outerReducer(rootReducer);
    const initialState = compose(applyMiddleware(asyncInitialState.middleware(loadStore.bind(null, storeUrl))));
    const enhancer = composeEnhancers(applyMiddleware(thunk, router));
    return createStore(
        reducer,
        initialState,
        enhancer
    );

Looks like the issues stems from using redux-immutable, which expects initial state to be instance of Immutable, so in this libraries case we return a Promise which results in error.

https://github.com/gajus/redux-immutable#problem

@cramatt can you also attach loadStore function? I suppose you're resolving Promise with object, but in your case it should be resolved with the instance of some Immutable object