Skip to content

Commit ef0d092

Browse files
authored
fix: make Show Simulation Box checkbox toggleable (fixes #308) (#309)
## Summary - The `useEffect` in `View.tsx` that synced `renderSettings.showSimulationBox` with `embedConfig.showSimulationBox` lacked an `isEmbeddedMode` guard - Since `embedConfig.showSimulationBox` defaults to `true`, any user toggle of the checkbox was immediately overwritten back to `true`, making it appear permanently enabled and unclickable - Fix: added `isEmbeddedMode &&` condition so the sync only runs when actually in embedded mode ## Behavior after fix - **Non-embedded mode**: checkbox is freely toggleable as expected - **Embedded mode**: `embedConfig.showSimulationBox` (from URL params) continues to override the setting, preserving existing behavior ## Test plan - [ ] Open the app in normal (non-embedded) mode → verify the "Show simulation box" checkbox in Settings can be checked/unchecked - [ ] Open the app in embedded mode with `showSimulationBox=false` in the URL config → verify the box is hidden and the setting is locked to `false` - [ ] Open the app in embedded mode with no explicit `showSimulationBox` config (defaults to `true`) → verify the box is shown - [ ] `npm run build` passes with no errors ✅ Closes #308 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 9dd7751 + a8f3259 commit ef0d092

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

src/containers/View.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -403,15 +403,18 @@ 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+
}, [isEmbeddedMode, embedConfig.showSimulationBox, renderSettings, setRenderSettings]);
415418

416419
// Update camera planes based on simulation box bounds
417420
useEffect(() => {

0 commit comments

Comments
 (0)