Skip to content

fix: make Show Simulation Box checkbox toggleable (fixes #308)#309

Merged
andeplane merged 3 commits intomainfrom
fix/show-simulation-box-checkbox
Feb 26, 2026
Merged

fix: make Show Simulation Box checkbox toggleable (fixes #308)#309
andeplane merged 3 commits intomainfrom
fix/show-simulation-box-checkbox

Conversation

@andeplane
Copy link
Owner

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

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>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @andeplane, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical UI bug where the "Show Simulation Box" checkbox appeared permanently enabled and untoggleable in the application's non-embedded mode. By introducing an isEmbeddedMode guard to a useEffect hook, the application now correctly respects user input for this setting when not in embedded mode, while preserving the intended override behavior when embedded.

Highlights

  • Show Simulation Box Checkbox Functionality: Corrected a bug where the "Show Simulation Box" checkbox was not toggleable in non-embedded mode. The useEffect hook responsible for syncing renderSettings.showSimulationBox with embedConfig.showSimulationBox now correctly applies the embedConfig only when isEmbeddedMode is true, preventing unintended overrides.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/containers/View.tsx
    • Modified a useEffect hook to include an isEmbeddedMode condition, ensuring that the showSimulationBox setting from embedConfig is only applied when the application is in embedded mode.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request correctly addresses the issue where the 'Show Simulation Box' checkbox was not toggleable in non-embedded mode. The fix, which involves adding an isEmbeddedMode guard to the useEffect, is appropriate. I've added one suggestion to further improve the useEffect by refining its dependency array for better performance and adherence to React best practices. Overall, a good fix.

Anders Hafreager and others added 2 commits February 26, 2026 14:44
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 <noreply@anthropic.com>
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 <noreply@anthropic.com>
@andeplane andeplane merged commit ef0d092 into main Feb 26, 2026
2 checks passed
@andeplane andeplane deleted the fix/show-simulation-box-checkbox branch February 26, 2026 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Show Simulation Box checkbox is always enabled and not clickable in Settings

1 participant