Skip to content

Commit 4d7a1df

Browse files
t3dotggclaude
andcommitted
perf(web): read the Local environment flag once in the root view
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a455a4b commit 4d7a1df

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎apps/web/src/routes/__root.tsx‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ function RootRouteBranch() {
143143
const pathname = useLocation({ select: (location) => location.pathname });
144144
const { authGateState } = Route.useRouteContext();
145145
const primaryEnvironmentAuthenticated = authGateState.status === "authenticated";
146+
// A sync IPC read; the setting only changes across a relaunch.
147+
const [localEnvironmentDisabled] = useState(isLocalEnvironmentDisabled);
146148
// Once true, stays true: a visit to /welcome means the bootstrap already chose a route.
147149
const [returningFromWelcome, setReturningFromWelcome] = useState(pathname === "/welcome");
148150
if (pathname === "/welcome" && !returningFromWelcome) setReturningFromWelcome(true);
@@ -195,7 +197,7 @@ function RootRouteBranch() {
195197
hostedStatic={authGateState.status === "hosted-static"}
196198
>
197199
{primaryEnvironmentAuthenticated ? <DesktopAppActivationCoordinator /> : null}
198-
{primaryEnvironmentAuthenticated || isLocalEnvironmentDisabled() ? (
200+
{primaryEnvironmentAuthenticated || localEnvironmentDisabled ? (
199201
<DesktopWebLinkCoordinator />
200202
) : null}
201203
{isElectron ? <RunningThreadKeepAlive /> : null}

0 commit comments

Comments
 (0)