Skip to content

Commit 2a415ce

Browse files
Anders Hafreagerclaude
andcommitted
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 <noreply@anthropic.com>
1 parent 9dd7751 commit 2a415ce

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/containers/View.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,23 @@ const View = ({ visible, isEmbeddedMode = false }: ViewProps) => {
403403
embedConfig.enableParticlePicking,
404404
]);
405405

406-
// Apply showSimulationBox setting from embed config
406+
// Apply showSimulationBox setting from embed config (only in embedded mode)
407407
useEffect(() => {
408-
if (renderSettings.showSimulationBox !== embedConfig.showSimulationBox) {
408+
if (
409+
isEmbeddedMode &&
410+
renderSettings.showSimulationBox !== embedConfig.showSimulationBox
411+
) {
409412
setRenderSettings({
410413
...renderSettings,
411414
showSimulationBox: embedConfig.showSimulationBox,
412415
});
413416
}
414-
}, [embedConfig.showSimulationBox, renderSettings, setRenderSettings]);
417+
}, [
418+
isEmbeddedMode,
419+
embedConfig.showSimulationBox,
420+
renderSettings,
421+
setRenderSettings,
422+
]);
415423

416424
// Update camera planes based on simulation box bounds
417425
useEffect(() => {

0 commit comments

Comments
 (0)