The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the cloud environment connect list compiles with the React Compiler (#20491)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:53 UTC
c1caac81ab32ec5912ee318aa23c8a2f5119dd8e
2 files changed
+46
-45
apps/web/reactCompiledFiles.ts
+1
@@ -66,4 +66,5 @@ export const REACT_COMPILED_FILES = [
66
"apps/web/src/components/device/DeviceSetup.tsx",
67
"apps/web/src/components/device/DevicePanel.tsx",
68
"apps/web/src/components/desktop/SshPasswordPromptDialog.tsx",
69
+ "apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx",
70
] as const;
apps/web/src/components/cloud/CloudEnvironmentConnectList.tsx
+45
-45
@@ -8,6 +8,7 @@ import {
8
import { relayOfflineReasonMessage } from "@t3tools/client-runtime/relay";
9
import {
10
isAtomCommandInterrupted,
11
+ settlePromise,
12
squashAtomCommandFailure,
13
} from "@t3tools/client-runtime/state/runtime";
14
import {
@@ -20,7 +21,7 @@ import type {
21
RelayEnvironmentStatusResponse,
22
} from "@t3tools/contracts/relay";
23
import * as Option from "effect/Option";
23
-import { type ReactNode, useCallback, useEffect, useEffectEvent, useState } from "react";
24
+import { type ReactNode, useEffect, useEffectEvent, useState } from "react";
25
26
import { environmentCatalog } from "~/connection/catalog";
27
import { cn } from "~/lib/utils";
@@ -99,18 +100,15 @@ export function CloudEnvironmentConnectRows({
100
if (environmentsState.refreshing || environmentsState.offline) return;
101
await refreshRelayEnvironments();
102
});
102
- const connectRelayEnvironment = useCallback(
103
- (environment: RelayClientEnvironmentRecord) =>
104
- registerEnvironment(
105
- new RelayConnectionRegistration({
106
- target: new RelayConnectionTarget({
107
- environmentId: environment.environmentId,
108
- label: environment.label,
109
- }),
103
+ const connectRelayEnvironment = (environment: RelayClientEnvironmentRecord) =>
104
+ registerEnvironment(
105
+ new RelayConnectionRegistration({
106
+ target: new RelayConnectionTarget({
107
+ environmentId: environment.environmentId,
108
+ label: environment.label,
109
}),
111
- ),
112
- [registerEnvironment],
113
- );
110
+ }),
111
+ );
112
const [connectingEnvironmentIds, setConnectingEnvironmentIds] = useState<
113
ReadonlySet<EnvironmentId>
114
>(new Set());
@@ -190,38 +188,43 @@ export function CloudEnvironmentConnectRows({
188
// During onboarding selection a machine saved over another route already
189
// has its own row elsewhere, and selecting it must not add a T3 Connect
190
// route as a side effect, so it is left out here.
191
+ const isVisibleEnvironment = (environmentId: EnvironmentId) =>
192
+ environmentId !== primaryEnvironmentId &&
193
+ (showSavedEnvironments || !savedById.has(environmentId)) &&
194
+ !(selection && savedWithoutRelay.has(environmentId));
195
const visibleEnvironments = [...environmentsState.environments.values()].filter(
194
- ({ environment }) =>
195
- environment.environmentId !== primaryEnvironmentId &&
196
- (showSavedEnvironments || !savedById.has(environment.environmentId)) &&
197
- !(selection && savedWithoutRelay.has(environment.environmentId)),
196
+ ({ environment }) => isVisibleEnvironment(environment.environmentId),
197
);
199
- const selectNewComputers = useEffectEvent(() => {
200
- const seen = selection?.autoSelectedComputers;
201
- if (!selection || !seen) return;
202
- for (const { environment, status, availability } of visibleEnvironments) {
203
- const id = environment.environmentId;
204
- if (availability === "checking") continue;
205
- if (
206
- discoveredCompatibilityError(status) !== null ||
207
- savedById.get(id)?.connection.phase === "unsupported"
208
- ) {
198
+ const selectNewComputers = useEffectEvent(
199
+ (environments: typeof environmentsState.environments) => {
200
+ const seen = selection?.autoSelectedComputers;
201
+ if (!selection || !seen) return;
202
+ for (const { environment, status, availability } of environments.values()) {
203
+ if (!isVisibleEnvironment(environment.environmentId)) continue;
204
+ const id = environment.environmentId;
205
+ if (availability === "checking") continue;
206
+ if (
207
+ discoveredCompatibilityError(status) !== null ||
208
+ savedById.get(id)?.connection.phase === "unsupported"
209
+ ) {
210
+ seen.add(id);
211
+ if (selection.selectedIds.has(id)) selection.onChange(id, false);
212
+ continue;
213
+ }
214
+ if (seen.has(id)) continue;
215
seen.add(id);
210
- if (selection.selectedIds.has(id)) selection.onChange(id, false);
211
- continue;
216
+ selection.onChange(id, true);
217
+ if (!savedById.has(id)) {
218
+ void connectEnvironment(environment).then((connected) => {
219
+ if (!connected) selection.onChange(id, false);
220
+ });
221
+ }
222
}
213
- if (seen.has(id)) continue;
214
- seen.add(id);
215
- selection.onChange(id, true);
216
- if (!savedById.has(id)) {
217
- void connectEnvironment(environment).then((connected) => {
218
- if (!connected) selection.onChange(id, false);
219
- });
220
- }
221
- }
222
- });
223
+ },
224
+ );
225
useEffect(() => {
224
- selectNewComputers();
226
+ // oxlint-disable-next-line react/set-state-in-effect -- Discovery results arrive from an external store and auto-selection starts relay connections, which mark themselves connecting.
227
+ selectNewComputers(environmentsState.environments);
228
}, [environmentsState.environments]);
229
230
// Discovery clears its list on refresh, so poll only until a machine appears.
@@ -244,12 +247,9 @@ export function CloudEnvironmentConnectRows({
247
if (disposed || pending || !visible()) return;
248
clearTimeout(timer);
249
pending = true;
247
- try {
248
- await refreshDiscoveryWhenIdle();
249
- } finally {
250
- pending = false;
251
- schedule();
252
- }
250
+ await settlePromise(() => refreshDiscoveryWhenIdle());
251
+ pending = false;
252
+ schedule();
253
};
254
const onFocus = () => void refresh();
255
const onVisibilityChange = () => {