Skip to content

fix(core): keep placement drafts out of undo history - #637

Merged
Aymericr merged 1 commit into
mainfrom
fix/transient-placement-history
Aug 11, 2026
Merged

fix(core): keep placement drafts out of undo history#637
Aymericr merged 1 commit into
mainfrom
fix/transient-placement-history

Conversation

@Aymericr

@Aymericr Aymericr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • exclude fresh placement roots and their descendants from scene history snapshots until finalization
  • remove transient references from parents, roots, and collections so both Zundo and external commit subscribers see a valid document snapshot
  • add a regression proving draft motion emits no history and finalization produces one undoable, redoable step

Test plan

  • bun run check
  • bun run check-types
  • bun run test
  • bun run build

Note

Medium Risk
Touches core scene history and commit boundaries used by undo and sync; behavior change is scoped to isNew placement 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.

sceneHistorySnapshotFromState now strips every isNew root and its full descendant subtree from history snapshots, and cleans parent children, rootNodeIds, and collections so Zundo and subscribeSceneCommits see a consistent document without transient nodes. Edits while still in draft mode produce no commits or undo steps; clearing isNew records one step whose before omits the subtree and whose current includes 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.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ 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,
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 71147a3. Configure here.

@Aymericr
Aymericr merged commit 34fbae7 into main Aug 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant