fix: undo after shallow snapshot import#1013
Open
zxch3n wants to merge 2 commits into
Open
Conversation
Model: gpt-5
Contributor
WASM Size Report
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1012.
Shallow snapshot imports that need to materialize latest state currently emit their internal checkout as a
Checkoutevent.UndoManagertreats checkout as a user-visible version switch, clears its stacks, and setsnext_countertoNone, so the first local commit after import only reinitializes the undo baseline instead of becoming an undo item.This change keeps explicit checkout behavior unchanged, but lets the shallow snapshot import materialization path emit that internal checkout as an
Importevent using the original import origin. That preserves subscriber visibility for the imported state while avoiding the UndoManager reset.Validation
cargo test -p loro --test loro_rust_test undo_records_first_local_commit_after_shallow_snapshot_import -- --nocapturecargo test -p loro --test loro_rust_test shallow_snapshot -- --nocapturecargo test -p loro --test issue -- --nocapturecargo test -p loro --test contracts events_subscriptions -- --nocapturecargo check -p loro-internalNote:
cargo checkstill reports the existingloro-common/src/lib.rsunused import warning, unrelated to this change.