fix(core): preserve plugin create fields

This commit is contained in:
Aymeric Rabot
2026-07-23 12:32:48 +02:00
parent 08d1bbf017
commit 4b27966f9a
2 changed files with 14 additions and 4 deletions
@@ -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' const kind = 'test:operation-forward-compatible'
if (!nodeRegistry.has(kind)) { if (!nodeRegistry.has(kind)) {
nodeRegistry._register({ nodeRegistry._register({
@@ -426,11 +426,21 @@ describe('scene commit boundary', () => {
collections: {}, collections: {},
dirtyNodes: new Set<AnyNodeId>(), dirtyNodes: new Set<AnyNodeId>(),
materials: {}, materials: {},
nodes: { [id]: node }, nodes: {},
rootNodeIds: [id], rootNodeIds: [],
}) })
clearSceneHistory() clearSceneHistory()
expect(
applySceneOperationPatch({
materialChanges: [],
nodeCreates: [{ node, position: 0 }],
nodeDeletes: [],
nodeUpdates: [],
}),
).toBe(true)
expect(useScene.getState().nodes[id]).toEqual(node)
expect( expect(
applySceneOperationPatch({ applySceneOperationPatch({
materialChanges: [], materialChanges: [],
+1 -1
View File
@@ -1525,7 +1525,7 @@ function sceneOperationPatchNextState(
return null return null
} }
createIds.add(parsed.id) 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) { for (const change of changes.nodeDeletes) {
const id = change.node.id const id = change.node.id