HyperFormula redo issue

Tags: #<Tag:0x00007f8b28d9a408> #<Tag:0x00007f8b28d99f58>

Hello. I have a question regarding the HyperFormula plugin.

I am unable to make ‘redo’ work in my table. After 3h of digging ( :sweat: ) I think I found out where it all goes wrong, so I wanted to ask you:

Why is it that everytime I make a change to my table (and by change I mean I manually change a value inside one of the cells), this method ‘setCellContents’ from ‘CrudOperations.ts’ clears the redo stack?

This is the reason I always have an error when I want to redo something in my table:

Yeah… i imagine there is no operation to redo because the redoStack has just been emptied… :cry:

I know it’s difficult to understand exactly what is happening, I have no real way to replicate in a jsfiddle my entire behaviour, I have tried, but I really just wanted to understand the reasoning behind the clearRedoStack() inside the setCellContents, or when is it specifically that the setCellContents method is called? Because maybe it’s an error of my side in how I am using the table.

I want to mention a few other things, maybe it matters:

  1. undo works very well, so it’s just a redo problem
  2. in my other HoT tables that do not have formulas, undo and redo work perfectly fine, so it’s just the one with the formulas that is creating this issue.
  3. i have defined my formulas engine like this:

image

Thank you!

Hi @vitorialipan

Thank you for detailed report. I tried to recreate this issue, but I’m not able to. Can you please tell me which version of Handsontable you use? I saw that we were fixing an issue related to undo/redo some time ago.

Hello,

Thank you for your reply!

Yes, I also tried to recreate it in a jsfiddle but I was unable to… :’)
Currently I am working with Handsontable version 13.1.0.

Thank you. So, the fix I mentioned was introduced in v. 12.4.0 so apparently, that’s not the case here.

However, without a replicable example it would be not possible to determine what causes this issue.

I can only ask our HyperFormula developer about this method and reason why the stack is cleared there. I’ll get back to you when I have more info on this.

Hi @vitorialipan

This is the explanation of the whole undo/redo operation process I got from our HyperFormula developer.

The redo() method is a way to "undo the last undo operation" . So calling redo() makes sense only immediately after an undo operation . When you trigger any data modification operation after the undo operation , the redo stack is reset, because it’s not clear which operation should be re-done.The redo() method is useful in such scenarios:

  1. Do some read and write operations
  2. Call undo() a few times
  3. (optionally) Do some read operations
  4. Call redo() to "undo the last undo operation "

The redo() method is not useful in such scenarios:

  1. Do some read and write operations
  2. Call undo() a few times
  3. Do some write operations
  4. Call redo() <- it’s not clear what should be re-done in this situation

Thank you!

I have created a custom redo function, as there is no other solution right now.

I have not been able to recreate this, so until I do, you can close this topic.

Thank you so much!
Have a great day!

Thank you for the update, if you find other solution feel free to share it here :slight_smile: