NyanCAD / Mosaic

A modern schematic entry and simulation program
https://nyancad.github.io/Mosaic/
Mozilla Public License 2.0
68 stars 5 forks source link

Undo/redo #9

Closed pepijndevos closed 2 years ago

pepijndevos commented 3 years ago

This is actually tricky considering real-time collaboration.

pepijndevos commented 2 years ago

Works partially, but not perfect yet.

pepijndevos commented 2 years ago

The main thing is undoing adding a new thing

pepijndevos commented 2 years ago

undoing adding/removing a thing actually works now. Though there is some glitch where you need to undo twice sometimes.

I think this is a "feature" of Hipflask which is only atomic on a per-document basis, and somehow deleting elements causes two writes to the underlying cache, which is being watched for changes.

pepijndevos commented 2 years ago

Fixed in Hipflask 0.8 except of course for the rare occasion where the cache is actually updated multiple times because a subset of the keys had a conflict and need to be retried while the others succeed.

But in that case you'd see an undo undo a partial action, which is not as bad as nothing happening at all, just kinda weird. But stuff will get weird anyway when multiple people start editing a document sooooo