Redux and multi level undo

Tags: #<Tag:0x00007efc6cf323b0>

Hello,

I am evaluating Handsontable at my company for usage in a future project.

We are loading the data from redux but it seems the undo feature can only undo the last change.

I have made this demo based on the Redux demo, but in this case undo doesn’t work at all.

Any tips?

https://jsfiddle.net/tqjnd0uw/1/

Thanks in advance.

Hi @pedro1

If you use Redux state you have to hold the undo-redo functionality by yourself.
This is why you can’t use our undoRedo.

You can consider using an existing library - https://github.com/omnidan/redux-undo.
Or you could look at how to approach this problem.
This is, for instance, a redux tutorial - https://redux.js.org/recipes/implementing-undo-history
So, on the one hand, you could store the entire state object as the present, past, and future.

On the other hand, you could use Immer which just store details about what has changed.
Here is a tutorial to implement Undo-Redo Functionality using Immer - https://techinscribed.com/implementing-undo-redo-functionality-in-redux-using-immer/?utm_source=stackoverflow&utm_medium=referral&utm_campaign=stackoverflow_answering

thanks for the help Piotr!