fix: prevent crash when duplicating elements (#239)

- Guard _buildCache in merged-outline-node against stale/disposed
  Object3D refs that cause TypeError on .id access during render
- Reset children array when duplicating roofs to prevent inconsistent
  parent-child relationships (matching existing stair behavior)
- Use obj?.parent check in EditorOutlinerSync to ensure objects are
  still in the scene graph before adding to outliner arrays
- Resume temporal state on parse failure to prevent undo/redo freeze

Closes #232
This commit is contained in:
Huy Hoang
2026-04-15 17:25:03 -04:00
committed by GitHub
parent e3ba4ab921
commit 3d1005847b
3 changed files with 17 additions and 5 deletions
@@ -600,9 +600,14 @@ export class MergedOutlineNode extends TempNode {
private _buildCache(objects: Object3D[], cache: Set<Object3D>) {
for (const obj of objects) {
obj.traverse((child: any) => {
if (child.isMesh || child.isSprite) cache.add(child)
})
if (!obj || !obj.traverse) continue
try {
obj.traverse((child: any) => {
if (child.isMesh || child.isSprite) cache.add(child)
})
} catch {
// Skip objects that were disposed or removed from the scene graph
}
}
}
}