tappleby / redux-batched-subscribe

store enhancer for https://github.com/reactjs/redux which allows batching subscribe notifications.
MIT License
504 stars 32 forks source link

Fix error in README.md #19

Closed shura-v closed 7 years ago

tappleby commented 7 years ago

There is a note in the readme about the ordering here:

Note: since compose applies functions from right to left, batchedSubscribe should appear at the end of the chain.

The compose function will call the enhancer functions in reverse order, since we want to "enhance" the base redux store as early as possible it is recommended to place batchedSubscribe last; This is because redux-batched-subscribe overrides the redux dispatch and subscribe logic.

With batchedSubscribe first, any middleware or custom enhancer (eg. redux-thunk) that calls dispatch would not get batched since they would be calling the base redux functions instead of the custom ones supplied by redux-batched-subscribe.