Undo is not working properly when an action is dispatched to the reducer in beforeChange/afterChange

Hi all,

I’m using handsontable’s react wrapper. My issue is here when I do ctrl + z or undo from the context menu, the only previous cell which has been edited will get undone. no other cell/row/column will get undone. I’m using the latest version of handsontable (7.2.2) and react wrapper for handsontable (3.1.0).

Below is the gif for my issue and notice that the performance is also very slow.

com-video-to-gif%20(1)com-video-to-gif%20(2)

I’ve added a sample code in codesandbox. Code related to handsontable is almost the same. But in codesandbox it’s working fine and performance is also smooth. But why am I facing the undo and performance issue in my browser?

I’ve tried various browsers such as google chrome, firefox, and edge. In all the browsers the issue is the same.

This is the same issue which I’m facing when we edit multiple cells and when I try to undo only previous cell will get undone.

https://codepen.io/handsoncode/pen/LWmvPX?editors=0010

Please, someone, help me with this issue.

Thank you.

I was debugging and I and to capture whatever user is editing i’m dispatching an action to the reducer. Because of that I’m unable to undo and also performance is very slow. Then how to dispatch an action to the reducer If I want to capture what user has edited in beforeChange/afterChange? :slightly_frowning_face:

Even in the sample code in codesandbox i’m dispatching an action but its working fine there and undo and performance is smooth. How the same code is effecting in my local.

I fixed the issue. The issue was in my project I had an unnecessary useSelector which used to re render the table component everytime any edit happened.

Thank you for the update. I guess that we can close the topic.

1 Like