Anyone have ideas on implementing an undo/redo history feature in an app?

I’m toying with the idea of implementing an undo/redo history feature in an app but am trying to decide what the best and most performance-friendly way to do this might be. Wanted to see if the Bubble community has any clever ideas.

There will be everything from undoing edits made to rich text to changes made to additions to/deletions from a list of things and even changes to a specific column/field.

1 Like

@eLPDev

Interesting. I guess it would be a combination of manual entries as well as automatic ones when key events or action take place that you want to keep a log of.

Create your log object, create an options set for the type of log and add all the displays you want to track, identify all the key actions and events where logs can be created automatically. Build the UI to render them and also to create the manual ones.

Thanks for chiming in so promptly (as always), @cmarchan, and thanks for sharing your ideas with me and the community. I’ll certainly be looking to head down that path.

One thing that adds some complexity is the fact that some of the edits I’ll be storing need to be sort orders for a drag/drop list.

@eLPDev Was curious if you found a great solution for this? I think the undo/redo history is such an important feature for an app and really would like to find a way to offer this solution. Thanks so much, Jeff.

I agree on the importance of an undo feature in an app. @eLPDev It’s been a while, but have you given this a shot yet or any recommendations to stay away from? @cmarchan have you ever implemented something like this? I definitely want to keep it light on the db, and my users already create a lot of data.

Cheers

I plan on implementing an under function as well. I haven’t tried it at all but my plan is to add a yes/no field to my thing called “isHistory” or something. Then another field called “Owner” or something and have the same datatype as itself. Then have a database trigger so if it sees any changes for it to create a new thing and basically copy all the fields “Before Change”. And it will set the “isHistory” to yes. And also will set the “Owner” to the thing that was changed.

So to view under history I have a repeating group and “Do a search for (thing)” where the Owner = (my thing in question) and the “isHistory” is yes. Then sort by creation date newest first.

It’s probably database intensive but not sure how else to do it on every single change done to a thing. There might be a way to revert to a copy of itself every minute to cut down on the things being created but I need to think that one out more.

No I have not.

To build functionality like this through Bubble expressions would be a tall order! :sweat_smile:

It’s a good idea to have a new field like isHistory (yes/no) to mark a thing as deleted and ready for an undo, though it will reduce DB workload to just make the update to isHistory on user input instead of trying to build backend workflows to catch different possible scenarios.

Also best to have a limit to the number of undos a thing can have.

1 Like