You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ApplyMiddleware can only be called once for a given store. If you have 2 instances of applyMiddleware in a single store, dispatch will not function as expected. Calling dispatch from the first group of applied middleware will not call middleware in the second batch. This is because the applyMiddleware function references a local dispatch function, rather than a single, canonical dispatch that lives on the store object.
What is the expected behavior?
I would argue the expected behavior is applyMiddleware can be applied several times. The docs are unclear on this point beyond stating it should be the first enhancer applied as the middleware may be asynchronous.
Allowing multiple invocations of applyMiddleware enables store enhancers that wrap different stores. Using the enhancer pattern, complex applications can be broken into smaller, composable pieces that are easier to test and reason about. This pattern requires that each enhancer can separately call applyMiddleware.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
Based on the history of the appllyMiddleware file, all versions of redux are affected. But because most people don't call applyMiddleware more than once, it probably has never come up before.
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
ApplyMiddleware can only be called once for a given store. If you have 2 instances of applyMiddleware in a single store, dispatch will not function as expected. Calling dispatch from the first group of applied middleware will not call middleware in the second batch. This is because the applyMiddleware function references a local dispatch function, rather than a single, canonical dispatch that lives on the store object.
What is the expected behavior?
I would argue the expected behavior is applyMiddleware can be applied several times. The docs are unclear on this point beyond stating it should be the first enhancer applied as the middleware may be asynchronous.
Allowing multiple invocations of applyMiddleware enables store enhancers that wrap different stores. Using the enhancer pattern, complex applications can be broken into smaller, composable pieces that are easier to test and reason about. This pattern requires that each enhancer can separately call applyMiddleware.
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
Based on the history of the appllyMiddleware file, all versions of redux are affected. But because most people don't call applyMiddleware more than once, it probably has never come up before.
The text was updated successfully, but these errors were encountered: