igniteui-angular icon indicating copy to clipboard operation
igniteui-angular copied to clipboard

`TransactionService.commit()` but keep undos?

Open SkylerLutz opened this issue 3 years ago • 10 comments

Question

Hi -- the scenario I'm targeting is, a user makes a bunch of edits to multiple rows in a grid, clicks save, and realizes they made a mistake--so they want to click undo. Currently, my save button calls TransactionService.commit(), which seems to wipe the undo stack. Is it possible to keep the undos so my user can revert to the state before the save? Thanks!

  • igniteui-angular version:
  • browser:

SkylerLutz avatar Sep 23 '21 14:09 SkylerLutz

@SkylerLutz The behavior that you observe is the expected for the Transaction service - this is how it was designed to work. Every time the user executes an operation (transaction), it is added to the transaction log and undo stack. Committing the changes affects (updates) the underlying data. So we are not able to simply undo the commit as every future update of the underlying data would mean a new commit. Furthermore, the service does not save information on past operations. You can see more detailed information on our Transaction Service in our help topics.

dafo avatar Sep 27 '21 12:09 dafo

@dafo I see -- thanks. Microsoft Word lets me undo after saving and I'd like to implement something similar -- can you think of any clever ways? Perhaps with two TransactionServices?

SkylerLutz avatar Sep 27 '21 14:09 SkylerLutz

@SkylerLutz You can try such implementation, however do not expect it to be a simple for implementation solution. Have in mind that the transactions that your "second" Transaction Service would keep will give you the diff state compared to the original state of the underlying data, not compared to the current state. Give it a try and let us know if you face any troubles while implementing the desired behavior.

dafo avatar Sep 28 '21 12:09 dafo

@dafo thanks! While I work on that can you please mark this as a feature request? Thanks

SkylerLutz avatar Sep 28 '21 13:09 SkylerLutz

@SkylerLutz Just an idea for another approach (not that it would be easier). You can try creating your custom Transaction Service, where the "pending changes" are kept permanently and undo functionality is available on them. However, this will introduce issues similar to the previous approach - you would again need to manage the state of the underlying data. Here is a read on our Transaction Service implementation where you can find something useful if you decide to try creating a custom Transaction Service. However, this is just another idea and not a recommendation.

dafo avatar Sep 28 '21 13:09 dafo

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Nov 28 '21 00:11 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Jan 29 '22 00:01 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Mar 31 '22 00:03 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar May 31 '22 00:05 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Jul 31 '22 00:07 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Oct 01 '22 00:10 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Dec 03 '22 00:12 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Feb 02 '23 00:02 github-actions[bot]

There has been no recent activity and this issue has been marked inactive.

github-actions[bot] avatar Apr 04 '23 00:04 github-actions[bot]