diff --git a/components/scenario-form.jsx b/components/scenario-form.jsx index 9ff4b64..528f47a 100644 --- a/components/scenario-form.jsx +++ b/components/scenario-form.jsx @@ -238,7 +238,14 @@ export default function ScenarioForm() { const branchScoped = useBranchScopedFixture(); // Toggle to control when the experiment view is visible vs production const [showExperimentView, setShowExperimentView] = useState( - typeof window !== "undefined" ? (window.sessionStorage?.getItem("ce-show-experiment") !== "false") : true, + typeof window !== "undefined" ? (() => { + const saved = sessionStorage?.getItem("ce-show-experiment"); + // Only default to true if user explicitly toggled ON (saved === "true") + // or has an active investigation context (session exists with situationGraph) + if (saved === "true") return true; + const session = getSession(); + return Boolean(session?.situationGraph); + })() : false, ); // Use fixture branches as the authoritative source when available @@ -457,7 +464,7 @@ export default function ScenarioForm() { return (
{/* ── RTO.26B — standalone branch-scoped experimental view (shown when experiment is active) ───── */} - {showExperimentView && status !== "loading" && (result?.situationGraph || status === "success") && ( + {showExperimentView && (result?.situationGraph || status === "success") && status !== "loading" && ( <>