fix(core): keep placement drafts out of undo history - #637
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 71147a3. Configure here.
| collections: historyCollections, | ||
| materials, | ||
| installedPlugins, | ||
| } |
There was a problem hiding this comment.
Marking live nodes new deletes history
High Severity
sceneHistorySnapshotFromState drops any node once metadata.isNew becomes true. Paths that first create a normal node and then set isNew (door/window paste) therefore emit a second local commit and undo step shaped like a delete: before still has the node, current does not. External commit subscribers and undo can then remove a just-pasted node.
Reviewed by Cursor Bugbot for commit 71147a3. Configure here.


Summary
Test plan
Note
Medium Risk
Touches core scene history and commit boundaries used by undo and sync; behavior change is scoped to
isNewplacement flows but incorrect subtree/collection filtering could affect undo or host patches.Overview
Placement drafts (
metadata.isNew) no longer enter undo stacks or scene commit snapshots until the user finalizes placement.sceneHistorySnapshotFromStatenow strips everyisNewroot and its full descendant subtree from history snapshots, and cleans parentchildren,rootNodeIds, and collections so Zundo andsubscribeSceneCommitssee a consistent document without transient nodes. Edits while still in draft mode produce no commits or undo steps; clearingisNewrecords one step whosebeforeomits the subtree and whosecurrentincludes the finalized placement (undo/redo removes or restores the whole subtree).A regression test covers create → draft motion → finalize → undo/redo.
Reviewed by Cursor Bugbot for commit 71147a3. Bugbot is set up for automated code reviews on this repo. Configure here.