tshelburne / redux-batched-actions

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

Combining with undo/redo #12

Open BrianHanechak opened 7 years ago

BrianHanechak commented 7 years ago

Any thoughts on how this should be integrated with an undo/redo manager? My application is currently using an undo/redo manager for only one part of it's larger state object. It would be nice to have batched action not create two items in the undo history.

I think my current application may not have an issue because I generally want to batch one action that makes changes to undo/redo with other actions that do not.

tshelburne commented 7 years ago

Can you describe your use-case a little more specifically? It's hard to make a general statement because batching can be done for a number of reasons.

In my projects, I use batching only for domain purposes - in other words, when the multiple changes taking place are a single semantic update, even if it takes running multiple reductions. In that case, undo / redo is philosophically the same, and the implementation depends on how your undo / redo functionality is handled.

Sometimes though, I can imagine batching actions simply for the purposes of performance, and that might not lend itself as nicely to undo / redo.