Skip to content
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

Expose notifyListeners in the store API #3180

Closed
migueloller opened this issue Oct 19, 2018 · 2 comments
Closed

Expose notifyListeners in the store API #3180

migueloller opened this issue Oct 19, 2018 · 2 comments

Comments

@migueloller
Copy link

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?

@markerikson
Copy link
Contributor

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.

See #1702 and #2214 for the PRs and discussion.

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.

@migueloller
Copy link
Author

@markerikson, gotcha. Thanks for the prompt response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants