-
-
Notifications
You must be signed in to change notification settings - Fork 15.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update applyMiddleware enhancer to use new createStore signature #1302
Conversation
Maybe just |
Yeah true. Although let's ask the question: should the enhancer passed to I think this is right (before) but... hmm. |
We don't ever want to encourage mixing both patterns. We'll transition docs to only use the new pattern, and the fact that the old one works will become an implementation detail. |
Even if we don't encourage it, I still think it's important as an implementation detail. At the least, it will be important for enhancer authors. Problem in a nutshell: const finalCreateStore = DevTools.instrument()(createStore)
const store = finalCreateStore(
reducer,
initialState,
applyMiddleware(thunk, logger)
) Which gets executed first: the DevTools, or the middleware? |
In this case, middleware will wrap the previously wrapped-with-DevTools function. (But really, nobody should do it) |
Update applyMiddleware enhancer to use new createStore signature
I trust that this works but please feel free to add tests. I'll release it as a patch bump now. |
Out in 3.1.1. |
@gaearon I don't think that's right. |
Oh, right. Lol this is counter-intuitive. But then again, it's not a breaking change since it's a new way of doing things. I don't think people will mess this up in their apps but we'll see. Even if they do mess up, we'll just offer to use the new way. |
Alright as long as we're aware of it :) |
3.1 changed the signature of
createStore()
. This isn't considered a breaking change because existing enhancers will continue to work; however, going forward, it should be expected that a store enhancer returns acreateStore
function with the same signature as its input.See https://twitter.com/acdlite/status/692772885186764802 for context
Still needs tests :)