tshelburne / redux-batched-actions

redux higher order reducer + action to reduce actions under a single subscriber notification
MIT License
1.05k stars 37 forks source link

Add support for redux-observable #26

Open hackhat opened 5 years ago

hackhat commented 5 years ago

At the moment I cannot use it with redux-observable.

So if I dispatch batched(action1, action2), redux-observable only receives the batchedAction. So not good. I could make the redux-observable to look into the batched actions, but I don't think is his job to do that. For example instead of listening to action1, will listen to

I think this is really bad as the epic should not care how a certain action is dispatched and this should be done to all epics because any action could be batched.

@manaflair/redux-batch made it in a way that works with redux-observable, please take a look.

Flash619 commented 4 years ago

Per the recipes section of the readme.

"You can add a middleware to dispatch each of the bundled actions. This can be used if other middlewares are listening for one of the bundled actions to be dispatched."

I've tested this together with redux-obervable and redux-observable-requests and it seems to parse each individual action as expected.

Edit

Only issue I'm seeing is the middleware can cause re-renders as it triggers listeners for each action in a batch. Perhaps the middleware could somehow tie into the native redux batch function?