fix(simulation): keep runtime stable on settings save
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user