-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undo/Redo #1008
Comments
What else needs to be done here? Is https://github.com/rocicorp/undo enough to close this? |
@arv there is a particular scenario that undo is not being handled correctly. Reference our We can open a new Issue to handle the invariant. |
I see. This is still future work then. |
Can we use this library already in production, or should we hold off until you launch this feature as part of the official Replicache? Undo/redo is a highly requested feature for us. |
Here is the notion doc @cesara mentions: https://replicache.notion.site/Redoing-undo-c0183b91d12c4272a3482e3233cc2890?pvs=4. It describes the edge case which this library doesn't handle. |
I think the notion doc misinterprets the "Figma principle" by ignoring the "and nothing else has happened in between" bit.
I think it would be more correct to think about the problem in the following way (everything I say below is in line with the Figma principle): When these conditions are not met the corresponding undo/redo operations should be skipped (and canUndo/canRedo should reflect it if there are not other actions the user can legally undo/redo). Otherwise, it leads to nonsensical results (user A clicks redo and that behaves as if user B clicked undo, confusing both) |
What you describe is very different than what Figma or any other collaborative editor I've ever used does, in particular:
and:
You can easily experiment in Figma and see that it doesn't behave this way. The video I pasted above shows one example. Our goal is to match the Figma behavior. There are some edge cases where we don't currently. The Notion doc describes the problem and a potential solution. |
it's actually very normal to lose the ability to Redo once the state has diverged from the state that the "matching" undo operation created. Every app I can think of does that. Here is a quick example from Canva (notice how typing after undoing disables the redo button): Sounds like you have a clear goal though, and I respect that. I think you guys are awesome. All the best! |
Just for future reference in case anyone finds it useful. I've dug into the subject, created a POC implementation and wrote this: https://dev.to/isaachagoel/you-dont-know-undoredo-4hol One of the readers pointed me to the undo/redo implementation by ProseMirror that implements similar ideas: |
Undo/redo is a very common feature request in collaborative applications and doing it correctly is somewhat subtle (e.g., see posts by Figma and Liveblocks).
Many Replicache users have created undo/redo on their own without too much trouble but it would be good to provide a solid, tested library analogous to https://github.com/rocicorp/fractional-indexing and other helper libraries we've released.
The text was updated successfully, but these errors were encountered: