The best way to control Claude Code, Codex and more from any computer or phone
perf(web): device hosts settings compile with the React Compiler (#20508)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:53 UTC
7091bc2495df63174afc4a14d6890c1aab7daf64
2 files changed
+50
-60
apps/web/reactCompiledFiles.ts
+1
@@ -83,4 +83,5 @@ export const REACT_COMPILED_FILES = [
83
"apps/web/src/components/settings/ProviderSetupSection.tsx",
84
"apps/web/src/components/settings/StorageSettings.tsx",
85
"apps/web/src/components/settings/DiagnosticsSettings.tsx",
86
+ "apps/web/src/components/settings/DeviceHostsSettings.tsx",
87
] as const;
apps/web/src/components/settings/DeviceHostsSettings.tsx
+49
-60
@@ -10,7 +10,7 @@ import { AppleIcon, AndroidIcon } from "../Icons";
10
import { Spinner } from "../ui/spinner";
11
import type { EnvironmentId, SshDeviceHostConfig } from "@t3tools/contracts";
12
import { randomUUID } from "../../lib/utils";
13
-import { useMemo, useState } from "react";
13
+import { useState } from "react";
14
import { deviceEnvironment } from "../../state/device";
15
import { serverEnvironment } from "../../state/server";
16
import { useAtomCommand } from "../../state/use-atom-command";
@@ -55,59 +55,52 @@ export function DeviceHostsSettings(props: { environmentId: EnvironmentId | null
55
connected: environment.connection.phase === "connected",
56
}));
57
const { checks, testConnection } = useHostConnectionChecks(targets);
58
- const hostEnvironments = useMemo(
59
- () =>
60
- connectedEnvironments.map((environment) => ({
61
- environmentId: environment.environmentId,
62
- label: environment.label,
63
- labels: settingsScopeEnvironmentLabels(environment, connectedEnvironments),
64
- hosts: environment.serverConfig?.settings.deviceHosts ?? [],
65
- })),
66
- [connectedEnvironments],
67
- );
68
- const groupedHosts = useMemo(() => groupDeviceHosts(hostEnvironments), [hostEnvironments]);
58
+ const hostEnvironments = connectedEnvironments.map((environment) => ({
59
+ environmentId: environment.environmentId,
60
+ label: environment.label,
61
+ labels: settingsScopeEnvironmentLabels(environment, connectedEnvironments),
62
+ hosts: environment.serverConfig?.settings.deviceHosts ?? [],
63
+ }));
64
+ const groupedHosts = groupDeviceHosts(hostEnvironments);
65
const save = async (host: SshDeviceHostConfig, remove = false, original = host) => {
66
if (!props.environmentId || projectScope) return;
67
setBusy(true);
72
- try {
73
- const results = await Promise.allSettled(
74
- environments.map(async (environment) => {
75
- if (environment.connection.phase !== "connected" || !environment.serverConfig) {
76
- throw new Error("Environment disconnected");
77
- }
78
- if (!readEnvironmentScope(environment.environmentId, AuthSettingsWriteScope)) {
79
- throw new Error("This connection cannot change device settings.");
80
- }
81
- return update({
82
- environmentId: environment.environmentId,
83
- input: {
84
- patch: {
85
- deviceHosts: updateDeviceHosts(
86
- environment.serverConfig.settings.deviceHosts,
87
- host,
88
- remove,
89
- original,
90
- ),
91
- },
68
+ const results = await Promise.allSettled(
69
+ environments.map(async (environment) => {
70
+ if (environment.connection.phase !== "connected" || !environment.serverConfig) {
71
+ throw new Error("Environment disconnected");
72
+ }
73
+ if (!readEnvironmentScope(environment.environmentId, AuthSettingsWriteScope)) {
74
+ throw new Error("This connection cannot change device settings.");
75
+ }
76
+ return update({
77
+ environmentId: environment.environmentId,
78
+ input: {
79
+ patch: {
80
+ deviceHosts: updateDeviceHosts(
81
+ environment.serverConfig.settings.deviceHosts,
82
+ host,
83
+ remove,
84
+ original,
85
+ ),
86
},
93
- });
94
- }),
95
- );
96
- const failed = environments.filter((_, index) => {
97
- const result = results[index];
98
- return result?.status !== "fulfilled" || result.value._tag === "Failure";
99
- });
100
- if (failed.length === 0) {
101
- setEditing(null);
102
- } else {
103
- toastManager.add({
104
- type: "error",
105
- title: "Device hosts not saved on all environments",
106
- description: `Could not update ${failed.map((environment) => environment.label).join(", ")}.`,
87
+ },
88
});
108
- }
109
- } finally {
110
- setBusy(false);
89
+ }),
90
+ );
91
+ setBusy(false);
92
+ const failed = environments.filter((_, index) => {
93
+ const result = results[index];
94
+ return result?.status !== "fulfilled" || result.value._tag === "Failure";
95
+ });
96
+ if (failed.length === 0) {
97
+ setEditing(null);
98
+ } else {
99
+ toastManager.add({
100
+ type: "error",
101
+ title: "Device hosts not saved on all environments",
102
+ description: `Could not update ${failed.map((environment) => environment.label).join(", ")}.`,
103
+ });
104
}
105
};
106
const listActions = {
@@ -246,18 +239,14 @@ function DeviceHostList({
239
]),
240
);
241
const states = useAtomValue(
249
- useMemo(
250
- () =>
251
- Atom.make(
252
- (get) =>
253
- new Map(
254
- environments.map(({ environmentId }) => {
255
- const result = get(deviceEnvironment.state({ environmentId, input: {} }));
256
- return [environmentId, Option.getOrUndefined(AsyncResult.value(result))] as const;
257
- }),
258
- ),
242
+ Atom.make(
243
+ (get) =>
244
+ new Map(
245
+ environments.map(({ environmentId }) => {
246
+ const result = get(deviceEnvironment.state({ environmentId, input: {} }));
247
+ return [environmentId, Option.getOrUndefined(AsyncResult.value(result))] as const;
248
+ }),
249
),
260
- [environments],
250
),
251
);
252
const retry = useAtomCommand(deviceEnvironment.list);