microsoft / redux-dynamic-modules

Modularize Redux by dynamically loading reducers and middlewares.
https://redux-dynamic-modules.js.org
MIT License
1.07k stars 116 forks source link

Middleware removed if added as enhancer #111

Open dbartholomae opened 4 years ago

dbartholomae commented 4 years ago

Hi there,

I'm currently changing over a website to use redux-dynamic-modules. It also uses react-router which lead me to the following problem. It seems, middleware that gets added as an enhancer is removed, potentially by the middleware handler. This code works:

export const store = createStore({
  initialState: {},
  extensions: [{
    middleware: [routerMiddleware]
  }]
}, getLegacyModule())

while this one doesn't:

export const store = createStore({
  initialState: {},
  enhancers: [applyMiddleware(routerMiddleware)]
}, getLegacyModule())

Specifically the middleware in the second case gets only some events and then doesn't get any events from Redux.

Not sure if this is intended, but if it is, it would be good to document it.

jeevasusej commented 4 years ago

Did you solve this issue?

dbartholomae commented 4 years ago

We are still using an extension. I'm currently thinking about setting up a redux-first-history extension.