From 1696b4742b45f0cf76567f3734dd778bf262d01a Mon Sep 17 00:00:00 2001 From: DCCONSTRUCTIONS Date: Wed, 26 Aug 2026 16:15:37 +0300 Subject: [PATCH] fix(simulation): keep runtime stable on settings save --- .../src/components/simulation/SimulationViewport.tsx | 6 +++++- apps/control-station/test/simulationWorkspace.test.mjs | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps/control-station/src/components/simulation/SimulationViewport.tsx b/apps/control-station/src/components/simulation/SimulationViewport.tsx index 32581de..7ba3d2b 100644 --- a/apps/control-station/src/components/simulation/SimulationViewport.tsx +++ b/apps/control-station/src/components/simulation/SimulationViewport.tsx @@ -62,6 +62,7 @@ export function SimulationViewport({ project.viewerSettings.camera.invertVertical, ); const [settingsError, setSettingsError] = useState(null); + const worldManifestRevision = JSON.stringify(project.worldManifest); useEffect(() => { const settings = project.viewerSettings; @@ -142,7 +143,10 @@ export function SimulationViewport({ runtime.dispose(); runtimeRef.current = null; }; - }, [project.projectId, project.worldManifest]); + // Saving viewer preferences returns a fresh project object. Restart the GPU + // runtime only when the manifest content changes, not when its object identity + // changes after an otherwise unrelated settings PUT. + }, [project.projectId, worldManifestRevision]); const collisionAvailable = project.worldManifest?.collision.available ?? false; const commitViewerSettings = (settings: SimulationViewerSettings) => { diff --git a/apps/control-station/test/simulationWorkspace.test.mjs b/apps/control-station/test/simulationWorkspace.test.mjs index 1fb5e08..0c3c13a 100644 --- a/apps/control-station/test/simulationWorkspace.test.mjs +++ b/apps/control-station/test/simulationWorkspace.test.mjs @@ -19,7 +19,7 @@ test("simulation is a dedicated Polygon workspace with a bounded feature slice", assert.match(productModel, /id: "simulations"[\s\S]*root: "polygon"[\s\S]*kind: "simulations"/); assert.match(workspaceHub, /case "simulations":[\s\S]*/); assert.match(workspace, /simulation-catalog__table/); - assert.match(workspace, /