-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Hi, this is a feature request
What is the current behavior?
Every dispatch cause all listeners to be called without the possibility to prevent it.
The "hackish" to do it would be with the enhancer
function from createStore
. I don't find this clean for the following reason:
It require to rewrite createStore
completely which make me wonder why do we require Redux in the first place if it's to pass a function that replace it completely.
What is the expected behavior?
I think allowing to pass a middleware would be helpfull for cases such as Redux used with Immutable.js. A middleware could verify that the state has muted and not call uselessly all the listeners if not. Other usecase could also apply such as "locking" dispatch in certain conditions for other performances reasons.
I think the goal of Redux is to notify the state changes, not to notify that a dispatch happen otherwise his role wouldn't be to hold a store a well but more a simple event bus system. Maybe I didn't get correctly the misson of Redux here so let me know if I'm in the wrong here.
The current Redux version is 3.6.0
this applies for all browsers / node environments and all OS
I currently have a working version of this which need polishing so I would provide the PR if this feature is accepted.
Thank you