Open maartendeblock opened 5 years ago
Hi @maartendeblock, I agree. This is a good first issue for someone wanting to contribute so I've added the tag. Thanks for the suggestion.
Hey @mwakerman, is it cool if I work on this? I've started it in my branch here https://github.com/vidushirai/kanbanist/tree/undo-button but I'm still working on using redux to store the last completed item instead of storing it in the state.
Hi @vidushirai, I've been thinking about this particular issue for a while. For checking off a single item, this would not be difficult to just provide an undo button. But for other API changes (renaming lists, re-ordering lists, adding/deleting lists etc.) I thought it might be a better approach to provide "temporary undo" by delaying API actions (the same way that Todoist and Gmail do) where there's an undo option available for 5 seconds or so before an action is "committed". This would be harder to implement but provide a more general solution to undoing changes. I haven't written any code but my thoughts on an implementation are:
todoist-persistence.js
middleware, add a setTimout
delay to all server changes.isCancelled
which returns true
or false
and is called at the end of the setTimeout
before the Todoist API is hit.isCancelled
is true
then we don't make the API request and we do a fetch to replace the local redux state with the "undone" server state.What do you think?
I like this approach better, i didn't know that's how Todoist and Gmail do it. I'd like to try implementing it this way and see how it goes.
Hi! Thought you might want to know that there's also a Todoist API to uncomplete an item. https://developer.todoist.com/sync/v7/#uncomplete-items
Hi,
It would be great to have an undo button when you checked off an item, just like normal Todoist client.
Thank you for your great work!