Skip to content

Commit c1bfb88

Browse files
sudhir9297claude
andcommitted
fix(viewer): restore appearance-change dirty-mark in GeometrySystem
The biome --unsafe autofix stripped [shading, textures, colorPreset, sceneTheme] from the mount effect's dep array, treating them as unused. They are deliberate re-run TRIGGERS: the effect re-marks every def.geometry node dirty whenever an appearance value changes, so the builders re-run and pick up the new shading / textures / color preset / scene theme. Without them, switching render mode, toggling textures, or changing the preset no longer rebuilds existing registry-driven geometry. All four are primitives (stable by value), so listing them is safe; added a scoped biome-ignore so the trigger-only deps survive future autofixes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent a3b5e4d commit c1bfb88

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

packages/viewer/src/systems/geometry/geometry-system.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ export const GeometrySystem = () => {
6464
// shelf dirties the shelf without altering its boards.
6565
const builtGeometryKeyRef = useRef<Map<string, string>>(new Map())
6666

67+
// Re-mark every geometry-backed node dirty whenever a viewer appearance
68+
// value changes, so `def.geometry` builders re-run and pick up the new
69+
// shading / texture / preset / theme. These four are deliberate re-run
70+
// TRIGGERS, not values read in the body — the effect re-fires on any
71+
// change. They're primitives (stable by value), so listing them is safe;
72+
// biome flags them as "unnecessary" because the body doesn't reference
73+
// them, but dropping them silently breaks appearance-mode switching.
74+
// biome-ignore lint/correctness/useExhaustiveDependencies: shading/textures/colorPreset/sceneTheme are intentional re-run triggers; removing them stops geometry from rebuilding on appearance change.
6775
useEffect(() => {
6876
const nodes = useScene.getState().nodes
6977
for (const node of Object.values(nodes)) {
@@ -72,7 +80,7 @@ export const GeometrySystem = () => {
7280
useScene.getState().markDirty(node.id as AnyNodeId)
7381
}
7482
}
75-
}, [])
83+
}, [shading, textures, colorPreset, sceneTheme])
7684

7785
useFrame(() => {
7886
if (dirtyNodes.size === 0) return

0 commit comments

Comments
 (0)