fix(shell): Open empties cross-doc clipboard

Codex caught: `clipboard: Vec<Node>` survives Open with nodes
carrying NodeIds from the previous doc. Pasting them into the
freshly-loaded doc would re-introduce ids the new allocator
doesn't know about (or collide with freshly-loaded rows). Empty
the clipboard alongside the history + UI resets so paste in the
new doc starts from empty.
This commit is contained in:
Kayshen-X 2026-05-12 22:46:00 +08:00
parent 3f77778c9e
commit d2f0bc1265

View file

@ -167,6 +167,11 @@ pub fn apply_payload(doc: &mut Document, payload: DocPayload) -> Result<(), Stri
doc.ui.locale_picker_open = false;
doc.ui.shape_picker_open = false;
doc.ui.fill_type_picker_open = false;
// Cross-doc clipboard contents are nodes carrying old NodeIds —
// pasting them into the freshly-loaded doc would re-introduce
// ids the new allocator doesn't know about (or collide with
// freshly-loaded rows). Empty the clipboard on Open.
doc.clipboard.clear();
Ok(())
}