Hacker News new | past | comments | ask | show | jobs | submit login

In reality, you're gonna quickly run into battles with state's that are complex and unclonable - in flight fetch requests, circular references, webasm modules that have internal state, etc.

Then there are things where the browser already implements undo functionality like navigation (back button) and editing text boxes. Your undo is going to have to work nicely with those.

You'll either end up with a buggy undo implementation, or end up spending a lot of engineering time hunting corner cases.




I am well aware of those challenges, but I believe for the purposes I need it for it will work just fine.


Is your moral just to give up?


Thats what the vast majority of webapps do...

Can't exactly log into facebook, post something to your wall, and then press Command+Z to undo the post, and the Command+Z again to undo the login...

No - both of the undo's have a special way to do it - click "delete post" followed by "log out".


Having Command-Z and Command-Y work with actions such as deleting a post or logging in doesn't help with having a proper undo system undo anyway.

Command-Z and Command-Y should be for document-based undo. Give the user some way of knowing what document they're working on. Even if the user is going to use the keyboard it helps to have Undo/Redo icons so they know what Undo/Redo applies to. Now, documents in code are more complex, but there's a wealth of research on it, and stuff like CRDTs and the history systems of libraries like ProseMirror and CodeMirror.

And often the undo of deleting a post is needed, but that's a separate thing, nowadays handled by the snackbar components. And if you really needed a redo, that would be something to put in a history feature.

Navigation does have a stack which works the same way as undo/redo but it doesn't normally use Command-Z and Command-Y.


But logging in and posting don't seem like "undoable" actions to me. That would be similar to undoing a save or undoing a login to Adobe CC in Photoshop. Things definitely get trickier with network requests, but that can be solved with something like CRDT.


The main reason you can't do that on Facebook is that it would confuse the hell out of people.


Navigation isn't usually "undo", conceptually.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: