Undo (Ctrl/Cmd-Z) fires a groupAction w/setCellValue, but vals are the current (i.e. reverting) ones

Reqt is to be notified of any value changes across the sheet to re-serialize it to JSON, and this naturally includes any manual Undo.

Was surprised to find both afterAction and beforeAction seem to capture the reverting (i.e. previous) value, not the value we`re reverting to.

Example:

  • a cell has “Apple” and you paste “Banana” over it, then hit Ctrl-Z
  • afterAction and beforeAction both fire a groupAction on the Ctrl-Z
  • one of the properties of the groupAction is a setCellValue action (so far, so good)
  • the val of the action contains ["Banana"], even though the value is changing back to “Apple”
  • there’s no prev on the action

This isn’t the biggest deal because at least setCellValue is triggered on revert and that’s all I need to know. But it seems like a bug — unless I’m missing something, afterAction should tell me what it’s setting (back) to.

Hello,

Thank you for the detailed description of the issue. This is not a bug but rather the current design of the undo/redo algorithm. However, I’ve passed this issue to the development team for a possible review of the behavior. I’ll let you know as soon as there is any additional information.

1 Like

Thanks for looking into it.

1 Like