Problem Actions in my redux store are appearing to log-jam behind one another. I'm iterating through a set of thunks, which each call a number of actions to show they've started, succeeded, etc. When this happens, an action appears for a second in redux dev tools, then is erased.
If I post another action, then all the actions appear all at once, like container ships following the ever-given.
In this gif I connect to a testing database, afterwards, a number of operations dispatch. I can see those operations in the console, but not devTools. Then, I post another action via the onscreen button, and all the actions flow through at once.
I'm hunting for instances of mutated state, but all reducers destructure state into a new object via:
let newState = {...state}
Any tips?
EDIT:
When I dispatch the same operation from behind a button element, it works just fine. The code that's log jamming is being called by an event listener attached to an event emitter... maybe this has something to do with it?
After debugging, I've traced the problem back to the redux replaceReducer method. I call it 3 times in this sequence. The first and second invocation works fine, but on the third - the store stops receiving actions.
store.injectReducer = (key, asyncReducer) => { storeTools.dispatchAction({type:"STORE_INJECT_REDUCER_" + key}) store.asyncReducers[key] = asyncReducer; let combinedReducers = createReducer(store.asyncReducers); storeTools.dispatchAction({type:"STORE_INJECT_REDUCER_" + key}) store.replaceReducer(combinedReducers); storeTools.dispatchAction({type:"RESET"}) console.log("replaceReducer")
}
^^^ This code prints actions on the first 2 invocations, but on the third, it prints the first two actions, but not the third.