From 124f572e90cbcaf99cf009777bd7edf05f766186 Mon Sep 17 00:00:00 2001 From: kay delaney Date: Thu, 14 Nov 2024 13:00:30 +0000 Subject: [PATCH 1/2] Utils: Spread objects in cloneSceneObjectState --- packages/scenes/src/core/sceneGraph/utils.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/scenes/src/core/sceneGraph/utils.ts b/packages/scenes/src/core/sceneGraph/utils.ts index 9dc9cabb6..985aada7d 100644 --- a/packages/scenes/src/core/sceneGraph/utils.ts +++ b/packages/scenes/src/core/sceneGraph/utils.ts @@ -45,6 +45,8 @@ export function cloneSceneObjectState( for (const child of propValue) { if (child instanceof SceneObjectBase) { newArray.push(child.clone()); + } else if (typeof child === 'object') { + newArray.push({ ...child }); } else { newArray.push(child); } From 72b5bea208a3508f44cdbf9cdbc6b2296ac85a2a Mon Sep 17 00:00:00 2001 From: kay delaney Date: Fri, 17 Jan 2025 12:23:10 +0000 Subject: [PATCH 2/2] Don't spread arrays --- packages/scenes/src/core/sceneGraph/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/scenes/src/core/sceneGraph/utils.ts b/packages/scenes/src/core/sceneGraph/utils.ts index 985aada7d..7ba98e708 100644 --- a/packages/scenes/src/core/sceneGraph/utils.ts +++ b/packages/scenes/src/core/sceneGraph/utils.ts @@ -45,7 +45,7 @@ export function cloneSceneObjectState( for (const child of propValue) { if (child instanceof SceneObjectBase) { newArray.push(child.clone()); - } else if (typeof child === 'object') { + } else if (typeof child === 'object' && !Array.isArray(child)) { newArray.push({ ...child }); } else { newArray.push(child);