From 2a415cee75f832b0f8c36c7e8d0d3f6c2c4ed606 Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Thu, 26 Feb 2026 14:39:35 +0100 Subject: [PATCH 1/3] fix: make Show Simulation Box checkbox toggleable (fixes #308) The useEffect in View.tsx that synced renderSettings.showSimulationBox with embedConfig.showSimulationBox lacked an isEmbeddedMode guard. Since embedConfig.showSimulationBox defaults to true, any user change to the checkbox was immediately overwritten back to true on every render cycle, making the checkbox appear permanently enabled and unresponsive. Fix: wrap the sync logic in an isEmbeddedMode check so it only runs when the app is actually embedded via URL config. Non-embedded mode now allows free toggling; embedded mode continues to have embedConfig take precedence as before. Co-Authored-By: Claude Sonnet 4.6 --- src/containers/View.tsx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/containers/View.tsx b/src/containers/View.tsx index caf0b24e..979a58c1 100644 --- a/src/containers/View.tsx +++ b/src/containers/View.tsx @@ -403,15 +403,23 @@ const View = ({ visible, isEmbeddedMode = false }: ViewProps) => { embedConfig.enableParticlePicking, ]); - // Apply showSimulationBox setting from embed config + // Apply showSimulationBox setting from embed config (only in embedded mode) useEffect(() => { - if (renderSettings.showSimulationBox !== embedConfig.showSimulationBox) { + if ( + isEmbeddedMode && + renderSettings.showSimulationBox !== embedConfig.showSimulationBox + ) { setRenderSettings({ ...renderSettings, showSimulationBox: embedConfig.showSimulationBox, }); } - }, [embedConfig.showSimulationBox, renderSettings, setRenderSettings]); + }, [ + isEmbeddedMode, + embedConfig.showSimulationBox, + renderSettings, + setRenderSettings, + ]); // Update camera planes based on simulation box bounds useEffect(() => { From 357946edaa784ce41d019e1aed08a603084819b2 Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Thu, 26 Feb 2026 14:44:30 +0100 Subject: [PATCH 2/3] refactor: tighten useEffect dependency array for showSimulationBox sync Use the functional update form of setRenderSettings so the effect only needs renderSettings.showSimulationBox (not the full renderSettings object) in its dependency array. This avoids re-running the effect on unrelated renderSettings changes and eliminates the stale-closure risk of spreading a captured renderSettings snapshot. Co-Authored-By: Claude Sonnet 4.6 --- src/containers/View.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/containers/View.tsx b/src/containers/View.tsx index 979a58c1..816a322c 100644 --- a/src/containers/View.tsx +++ b/src/containers/View.tsx @@ -409,15 +409,15 @@ const View = ({ visible, isEmbeddedMode = false }: ViewProps) => { isEmbeddedMode && renderSettings.showSimulationBox !== embedConfig.showSimulationBox ) { - setRenderSettings({ - ...renderSettings, + setRenderSettings((prev) => ({ + ...prev, showSimulationBox: embedConfig.showSimulationBox, - }); + })); } }, [ isEmbeddedMode, embedConfig.showSimulationBox, - renderSettings, + renderSettings.showSimulationBox, setRenderSettings, ]); From a8f3259625fe7f83bdf2ad024e5104b36f2ced09 Mon Sep 17 00:00:00 2001 From: Anders Hafreager Date: Thu, 26 Feb 2026 14:46:45 +0100 Subject: [PATCH 3/3] fix: use direct value for setRenderSettings (fixes typecheck) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setRenderSettings is an easy-peasy action, not a React useState setter, so it only accepts a RenderSettings value directly — not a functional update callback. Revert to spreading renderSettings directly while keeping the isEmbeddedMode guard and tighter dependency array from the previous two commits. Co-Authored-By: Claude Sonnet 4.6 --- src/containers/View.tsx | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/containers/View.tsx b/src/containers/View.tsx index 816a322c..f0db5c41 100644 --- a/src/containers/View.tsx +++ b/src/containers/View.tsx @@ -409,17 +409,12 @@ const View = ({ visible, isEmbeddedMode = false }: ViewProps) => { isEmbeddedMode && renderSettings.showSimulationBox !== embedConfig.showSimulationBox ) { - setRenderSettings((prev) => ({ - ...prev, + setRenderSettings({ + ...renderSettings, showSimulationBox: embedConfig.showSimulationBox, - })); + }); } - }, [ - isEmbeddedMode, - embedConfig.showSimulationBox, - renderSettings.showSimulationBox, - setRenderSettings, - ]); + }, [isEmbeddedMode, embedConfig.showSimulationBox, renderSettings, setRenderSettings]); // Update camera planes based on simulation box bounds useEffect(() => {