tshaddix / webext-redux

A set of utilities for building Redux applications in Web Extensions.
MIT License
1.22k stars 180 forks source link

Forward redux events to remote stores #247

Open zshannon opened 4 years ago

zshannon commented 4 years ago

Hey folks, thanks for a great package! I ran into the same issue as a couple other people where I wasn't getting actions to trigger my side-effects on my remote stores. I added a redux middleware to the background store in wrapStore that drops every action into the message bus for the remote stores and re-dispatches them on the remote so they can get picked up by side-effects.

NB: I didn't think carefully about the ordering of messages here because it doesn't matter for my use case, but would probably be a good idea if you've got the time to think about when the actions and state patches arrive at the remote ;)