Skip to content

Commit 5df4320

Browse files
fix(desktop): thread links open when the local environment is disabled
With the local environment disabled, the root route never mounted the desktop link listener, and the listener waited for a local environment that never connects. Mount it on every desktop client, and skip the wait when the local environment is disabled. Links still wait for the local environment when it is enabled. Closes #25888
1 parent 55ed2bc commit 5df4320

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎apps/web/src/components/desktop/DesktopWebLinkCoordinator.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { useNewThreadHandler } from "../../hooks/useHandleNewThread";
1616
import { useScratchProject } from "../../hooks/useScratchProject";
1717
import { useClientSettings } from "../../hooks/useSettings";
1818
import { useOpenChangeRequestLink } from "../../lib/openPullRequestLink";
19+
import { isLocalEnvironmentDisabled } from "../../localEnvironment";
1920
import { selectActiveRightPanelSurface, useRightPanelStore } from "../../rightPanelStore";
2021
import { appAtomRegistry } from "../../rpc/atomRegistry";
2122
import { resolveThreadRouteTarget } from "../../threadRoutes";
@@ -85,10 +86,12 @@ export function DesktopWebLinkCoordinator() {
8586
const httpBaseUrl = useEnvironmentHttpBaseUrl(primaryEnvironment?.environmentId ?? null);
8687
const queueRef = useRef(Promise.resolve());
8788
const webLinks = window.desktopBridge?.webLinks;
89+
// No primary ever connects with the local environment disabled; links that need one toast.
8890
const ready =
8991
webLinks !== undefined &&
90-
primaryEnvironment?.connection.phase === "connected" &&
91-
primaryEnvironment.serverConfig !== null;
92+
(isLocalEnvironmentDisabled() ||
93+
(primaryEnvironment?.connection.phase === "connected" &&
94+
primaryEnvironment.serverConfig !== null));
9295

9396
const reportFailure = (url: string, description = url) =>
9497
toastManager.add(

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ function RootRouteBranch() {
195195
hostedStatic={authGateState.status === "hosted-static"}
196196
>
197197
{primaryEnvironmentAuthenticated ? <DesktopAppActivationCoordinator /> : null}
198-
{primaryEnvironmentAuthenticated ? <DesktopWebLinkCoordinator /> : null}
198+
{isElectron ? <DesktopWebLinkCoordinator /> : null}
199199
{isElectron ? <RunningThreadKeepAlive /> : null}
200200
<RelayClientInstallDialog />
201201
<ConnectOnboardingDialog />

0 commit comments

Comments
 (0)