fix(simulation): keep runtime stable on settings save

This commit is contained in:
DCCONSTRUCTIONS
2026-08-26 16:15:37 +03:00
parent ac1dc7d930
commit 1696b4742b
2 changed files with 9 additions and 2 deletions
@@ -62,6 +62,7 @@ export function SimulationViewport({
project.viewerSettings.camera.invertVertical,
);
const [settingsError, setSettingsError] = useState<string | null>(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) => {