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
When creating a store enhancer and reimplementing the dispatch() method, one usually has to reimplement subscribe() and keep track of listeners. If the store expose notifyListeners() in its API, it would greatly simplify some store enhancer implementations.
For example, redux-batched-subscribe's source code almost reimplements all of Redux but loses on the benefits of good error messages and other updates to the Redux codebase. If notifyListeners() was exposed, then it would only reimplement dispatch() and not subscribe().
Thoughts?
The text was updated successfully, but these errors were encountered:
Yeah, there were a couple different ideas back in 2016 of ways to refactor out some of that common enhancer behavior. Dan Abramov had one suggestion, Jim Bolla had a different one. They both sat open for a couple years and clearly weren't going anywhere, so we closed them.
We definitely have no plans to modify the store itself to expose that behavior. If someone wanted to revisit those two "enhancer revamp" PRs and put together a new proposal, I'd at least look at it, but in practice the copy-paste aspect doesn't seem to have actually been enough of a problem to justify changes to how enhancers work.
When creating a store enhancer and reimplementing the
dispatch()
method, one usually has to reimplementsubscribe()
and keep track of listeners. If the store exposenotifyListeners()
in its API, it would greatly simplify some store enhancer implementations.For example,
redux-batched-subscribe
's source code almost reimplements all of Redux but loses on the benefits of good error messages and other updates to the Redux codebase. IfnotifyListeners()
was exposed, then it would only reimplementdispatch()
and notsubscribe()
.Thoughts?
The text was updated successfully, but these errors were encountered: