Undo event

Hi, is there a way to catch a different task event whenever a task changes?

Currently on each new task I reset some variables client side and that's easy to do with the answer event. However if the user undos and since there's various ways to undo (Click the undo button, select a task from the sidebar, the key binding) it is somehow hard to catch the undo event.

This could also be solved by having a task-mount or something similar that could signal any change in task regardless of if it was answered or not.

I tried using the update event but couldn't find any info on that event to detect the undo event.

At the moment Im getting away with comparing the task content and saving a lastTask variable.

Yes, good point! It shouldn't be a problem to just add a separate custom event for this :+1:

The event would capture any action that puts a task back to the "front of the queue" (since this is how it's also implemented internally). This includes the undo action to re-annotate the previous task, but also clicking on an item in the sidebar history.

Edit: In the meantime, a hacky workaround could be to keep a record of the task._task_hash values on the client. If you see the same task hash again, it's because the user hit undo to re-annotate it (unless I'm missing an alternative scenario here – but I don't think so).

Edit 2: Okay, that was easy. The next version will have a prodigyundo event as well.

1 Like