-
Notifications
You must be signed in to change notification settings - Fork 0
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
Implement undo/redo with zundo #157
base: main
Are you sure you want to change the base?
Conversation
This is working better now (possibly to undo/redo paint actions and those get reflected on the map). I think that I need to change the equality function to make sure it doesn't save intermediate / invisible changes |
ok, interestingly by the undo/redo works pretty well by default after a block has a paint or eraser (null) value attached to it. Then actions after that can be undone. Will revisit |
There is an optimization that checks the previous state before changing the feature state, but this is producing some unexpected behavior. For now, I'd recommend removing this and just have all the zone assignments assigned each time. districtr-v2/app/src/app/utils/helpers.ts Line 345 in 6cc5e6e
Also as a heads up there will be some substantial merge conflicts coming in from main! |
Just wanted to flag some additional complexity coming down the pipeline for this PR. With breaking (shattering) and healing (unshattering) we may need to track shatter IDs or shatter mappings in the temporal state. Undo and redo break/heal may get a bit tricky. I'm thinking the most minimal way to handle this could be:
A pitfall here is going to be if on heal/break there is a new zone assignment created, if that would break the previous undo/redo event chain. I think the way |
I agree this should be paused especially since I don't know enough yet about shattering to say anything informed on implementing that |
Testing if we can replace #118 with the zundo plugin , and whether GitHub Actions will produce a test build for this
Issues:
onSave
still needs to update MapBox and the server