fix(editor): app-state ownership travels with undo and batch rollback
MergeAppState's key->plan_idx ownership lived only on EditorState, so a rolled-back batch or an undo restored doc.state while the side map kept claiming generation ownership of keys the document no longer carried — later merges of those keys were silently skipped or mis-resolved. Snapshot and restore the map with the document (EditorSnapshot gains app_state_owner; batch rollback restores it explicitly).
This commit is contained in:
parent
f4e8e62ec0
commit
fc864a01ab
|
|
@ -128,9 +128,15 @@ fn rolled_back_batch_leaves_no_stale_app_state_ownership() {
|
|||
},
|
||||
],
|
||||
});
|
||||
assert!(!failed, "batch with a failing sub-command must report false");
|
||||
assert!(
|
||||
s.doc.state.as_ref().is_none_or(|st| !st.contains_key("cart")),
|
||||
!failed,
|
||||
"batch with a failing sub-command must report false"
|
||||
);
|
||||
assert!(
|
||||
s.doc
|
||||
.state
|
||||
.as_ref()
|
||||
.is_none_or(|st| !st.contains_key("cart")),
|
||||
"rolled-back merge must not survive in doc.state"
|
||||
);
|
||||
|
||||
|
|
@ -166,7 +172,10 @@ fn undo_restores_app_state_ownership_with_the_document() {
|
|||
|
||||
assert!(s.undo(), "batch lands as one undo step");
|
||||
assert!(
|
||||
s.doc.state.as_ref().is_none_or(|st| !st.contains_key("tab")),
|
||||
s.doc
|
||||
.state
|
||||
.as_ref()
|
||||
.is_none_or(|st| !st.contains_key("tab")),
|
||||
"undo must remove the merged key from doc.state"
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue