From 4b27966f9a3cdb11ad0829e7b4b7552def888c7c Mon Sep 17 00:00:00 2001 From: Aymeric Rabot Date: Thu, 23 Jul 2026 12:32:48 +0200 Subject: [PATCH] fix(core): preserve plugin create fields --- .../core/src/store/use-scene-commits.test.ts | 16 +++++++++++++--- packages/core/src/store/use-scene.ts | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/core/src/store/use-scene-commits.test.ts b/packages/core/src/store/use-scene-commits.test.ts index 05ce19d9..fb481e8e 100644 --- a/packages/core/src/store/use-scene-commits.test.ts +++ b/packages/core/src/store/use-scene-commits.test.ts @@ -391,7 +391,7 @@ describe('scene commit boundary', () => { } }) - test('validates registered nodes without stripping forward-compatible fields', () => { + test('validates registered creates and updates without stripping forward-compatible fields', () => { const kind = 'test:operation-forward-compatible' if (!nodeRegistry.has(kind)) { nodeRegistry._register({ @@ -426,11 +426,21 @@ describe('scene commit boundary', () => { collections: {}, dirtyNodes: new Set(), materials: {}, - nodes: { [id]: node }, - rootNodeIds: [id], + nodes: {}, + rootNodeIds: [], }) clearSceneHistory() + expect( + applySceneOperationPatch({ + materialChanges: [], + nodeCreates: [{ node, position: 0 }], + nodeDeletes: [], + nodeUpdates: [], + }), + ).toBe(true) + expect(useScene.getState().nodes[id]).toEqual(node) + expect( applySceneOperationPatch({ materialChanges: [], diff --git a/packages/core/src/store/use-scene.ts b/packages/core/src/store/use-scene.ts index e60136ba..6d88cfbd 100644 --- a/packages/core/src/store/use-scene.ts +++ b/packages/core/src/store/use-scene.ts @@ -1525,7 +1525,7 @@ function sceneOperationPatchNextState( return null } createIds.add(parsed.id) - parsedCreates.push({ node: parsed, position: change.position }) + parsedCreates.push({ node: change.node, position: change.position }) } for (const change of changes.nodeDeletes) { const id = change.node.id