fix: make Show Simulation Box checkbox toggleable (fixes #308)#309
fix: make Show Simulation Box checkbox toggleable (fixes #308)#309
Conversation
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>
Summary of ChangesHello @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 Highlights
🧠 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
Activity
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
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.
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>
Summary
useEffectinView.tsxthat syncedrenderSettings.showSimulationBoxwithembedConfig.showSimulationBoxlacked anisEmbeddedModeguardembedConfig.showSimulationBoxdefaults totrue, any user toggle of the checkbox was immediately overwritten back totrue, making it appear permanently enabled and unclickableisEmbeddedMode &&condition so the sync only runs when actually in embedded modeBehavior after fix
embedConfig.showSimulationBox(from URL params) continues to override the setting, preserving existing behaviorTest plan
showSimulationBox=falsein the URL config → verify the box is hidden and the setting is locked tofalseshowSimulationBoxconfig (defaults totrue) → verify the box is shownnpm run buildpasses with no errors ✅Closes #308
🤖 Generated with Claude Code