The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the remote open hook compiles without manual memoization (#20646)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:57 UTC
0ed3ae8a2d6e2fc3173fd3e0dec6caedcbcbee58
1 file changed
+19
-20
apps/web/src/remoteOpen.ts
+19
-20
@@ -7,7 +7,7 @@ import {
7
} from "@t3tools/contracts";
8
import * as Option from "effect/Option";
9
import * as Schema from "effect/Schema";
10
-import { useEffect, useMemo, useState } from "react";
10
+import { useEffect, useState } from "react";
11
12
import { isDesktopLocalConnectionTarget } from "~/connection/desktopLocal";
13
import { isLoopbackHostname } from "~/environments/primary/target";
@@ -82,28 +82,27 @@ export function resolveRemoteOpenState(input: {
82
83
export function useRemoteOpenResolution(environmentId: EnvironmentId | null): RemoteOpenResolution {
84
const { presentation } = useEnvironmentPresentation(environmentId);
85
- // The presentation changes with every server config push. Memoize on the
86
- // pieces read here so callers keep a stable result across provider updates.
85
+ // The presentation changes with every server config push. Read only the pieces
86
+ // used here so the compiler keys the result on them and callers keep a stable
87
+ // result across provider updates.
88
const entry = presentation?.entry ?? null;
89
const remoteOpenTargets = presentation?.serverConfig?.remoteOpenTargets;
90
90
- return useMemo(() => {
91
- if (entry === null) {
92
- return UNRESOLVED_REMOTE_OPEN;
93
- }
94
- const profile = Option.getOrNull(entry.profile);
95
- const sshAlias =
96
- profile !== null && profile._tag === "SshConnectionProfile" ? profile.target.alias : null;
97
- return {
98
- state: resolveRemoteOpenState({
99
- target: entry.target,
100
- sshAlias,
101
- remoteOpenTargets,
102
- isDesktopRenderer: window.desktopBridge !== undefined,
103
- }),
104
- isResolved: true,
105
- };
106
- }, [entry, remoteOpenTargets]);
91
+ if (entry === null) {
92
+ return UNRESOLVED_REMOTE_OPEN;
93
+ }
94
+ const profile = Option.getOrNull(entry.profile);
95
+ const sshAlias =
96
+ profile !== null && profile._tag === "SshConnectionProfile" ? profile.target.alias : null;
97
+ return {
98
+ state: resolveRemoteOpenState({
99
+ target: entry.target,
100
+ sshAlias,
101
+ remoteOpenTargets,
102
+ isDesktopRenderer: window.desktopBridge !== undefined,
103
+ }),
104
+ isResolved: true,
105
+ };
106
}
107
108
export function useRemoteOpenState(environmentId: EnvironmentId | null): RemoteOpenState {