The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 23, 08:00 UTC
perf(web): pull request actions compile with the React Compiler (#20492)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:53 UTC
409140911b59dc72c205148a94b916380ba72744
2 files changed
+65
-76
apps/web/reactCompiledFiles.ts
+1
@@ -67,4 +67,5 @@ export const REACT_COMPILED_FILES = [
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
+ "apps/web/src/components/pullRequest/usePullRequestActions.ts",
71
] as const;
apps/web/src/components/pullRequest/usePullRequestActions.ts
+64
-76
@@ -9,7 +9,7 @@ import type {
9
PullRequestMergeMethod,
10
PullRequestRef,
11
} from "@t3tools/contracts";
12
-import { useCallback, useRef, useState } from "react";
12
+import { useRef, useState } from "react";
13
import { resolveProjectSettings } from "@t3tools/shared/projectSettings";
14
import { useClientSettings, useEnvironmentSettings } from "~/hooks/useSettings";
15
import {
@@ -43,7 +43,7 @@ export function usePullRequestDefaultMergeMethodResolver(
43
const grouping = useClientSettings(selectProjectGroupingSettings);
44
const projects = useProjects();
45
const primaryEnvironmentId = usePrimaryEnvironmentId();
46
- return useCallback(() => {
46
+ return () => {
47
if (projectDefault != null) return projectDefault;
48
if (Object.keys(legacyOverrides).length === 0) return undefined;
49
const project = projects.find(
@@ -58,15 +58,7 @@ export function usePullRequestDefaultMergeMethodResolver(
58
}).get(derivePhysicalProjectKey(project)) ??
59
deriveLogicalProjectKeyFromSettings(project, grouping);
60
return legacyOverrides[key];
61
- }, [
62
- projectDefault,
63
- projects,
64
- environmentId,
65
- projectId,
66
- grouping,
67
- primaryEnvironmentId,
68
- legacyOverrides,
69
- ]);
61
+ };
62
}
63
64
const ACTION_SUCCESS_LABELS: Record<PullRequestAction, string> = {
@@ -140,28 +132,29 @@ export function usePullRequestActionRunner({
132
if (pendingRef.current || reference === null) return;
133
pendingRef.current = true;
134
setActionPending(true);
143
- try {
144
- const result = await runAction({
145
- environmentId,
146
- input: {
147
- ...reference,
148
- action,
149
- ...(method ? { mergeMethod: method } : resolveMergeMethod ? { resolveMergeMethod } : {}),
150
- },
151
- });
152
- if (result._tag === "Failure") throw squashAtomCommandFailure(result);
153
- toastManager.add({ type: "success", title: ACTION_SUCCESS_LABELS[action] });
154
- onSuccess?.(action);
155
- } catch (failure) {
135
+ const result = await runAction({
136
+ environmentId,
137
+ input: {
138
+ ...reference,
139
+ action,
140
+ ...(method ? { mergeMethod: method } : resolveMergeMethod ? { resolveMergeMethod } : {}),
141
+ },
142
+ });
143
+ pendingRef.current = false;
144
+ setActionPending(false);
145
+ if (result._tag === "Failure") {
146
toastManager.add({
147
type: "error",
148
title: ACTION_FAILURE_LABELS[action],
159
- description: readableFailure(failure, ACTION_FAILURE_HINTS[action]),
149
+ description: readableFailure(
150
+ squashAtomCommandFailure(result),
151
+ ACTION_FAILURE_HINTS[action],
152
+ ),
153
});
161
- } finally {
162
- pendingRef.current = false;
163
- setActionPending(false);
154
+ return;
155
}
156
+ toastManager.add({ type: "success", title: ACTION_SUCCESS_LABELS[action] });
157
+ onSuccess?.(action);
158
};
159
160
return { actionPending, perform };
@@ -171,55 +164,50 @@ export function usePullRequestCloseBatch(onClosed: (entry: EnvironmentPullReques
164
const runAction = useAtomCommand(pullRequestEnvironment.runAction, { reportFailure: false });
165
const pending = useRef(new Set<string>());
166
const [closingKeys, setClosingKeys] = useState<ReadonlySet<string>>(() => new Set());
174
- const close = useCallback(
175
- async (entries: readonly EnvironmentPullRequestEntry[]) => {
176
- const batch = entries.filter((entry) => {
177
- const key = pullRequestEntryKey(entry);
178
- if (entry.state !== "open" || pending.current.has(key)) return false;
179
- pending.current.add(key);
167
+ const close = async (entries: readonly EnvironmentPullRequestEntry[]) => {
168
+ const batch = entries.filter((entry) => {
169
+ const key = pullRequestEntryKey(entry);
170
+ if (entry.state !== "open" || pending.current.has(key)) return false;
171
+ pending.current.add(key);
172
+ return true;
173
+ });
174
+ if (batch.length === 0) return;
175
+ setClosingKeys(new Set(pending.current));
176
+ const failures: string[] = [];
177
+ const outcomes = await Promise.all(
178
+ batch.map(async (entry) => {
179
+ const result = await runAction({
180
+ environmentId: entry.environmentId,
181
+ input: {
182
+ projectId: entry.projectId,
183
+ host: entry.host,
184
+ repository: entry.repository,
185
+ number: entry.number,
186
+ action: "close",
187
+ },
188
+ });
189
+ pending.current.delete(pullRequestEntryKey(entry));
190
+ setClosingKeys(new Set(pending.current));
191
+ if (result._tag === "Failure") {
192
+ failures.push(
193
+ `#${entry.number}: ${readableFailure(squashAtomCommandFailure(result), ACTION_FAILURE_HINTS.close)}`,
194
+ );
195
+ return;
196
+ }
197
+ onClosed(entry);
198
return true;
181
- });
182
- if (batch.length === 0) return;
183
- setClosingKeys(new Set(pending.current));
184
- let closed = 0;
185
- const failures: string[] = [];
186
- await Promise.all(
187
- batch.map(async (entry) => {
188
- try {
189
- const result = await runAction({
190
- environmentId: entry.environmentId,
191
- input: {
192
- projectId: entry.projectId,
193
- host: entry.host,
194
- repository: entry.repository,
195
- number: entry.number,
196
- action: "close",
197
- },
198
- });
199
- if (result._tag === "Failure") throw squashAtomCommandFailure(result);
200
- closed++;
201
- onClosed(entry);
202
- } catch (failure) {
203
- failures.push(
204
- `#${entry.number}: ${readableFailure(failure, ACTION_FAILURE_HINTS.close)}`,
205
- );
206
- } finally {
207
- pending.current.delete(pullRequestEntryKey(entry));
208
- setClosingKeys(new Set(pending.current));
209
- }
210
- }),
211
- );
212
- toastManager.add({
213
- type: failures.length > 0 ? "error" : "success",
214
- title:
215
- failures.length > 0
216
- ? `Closed ${closed} of ${batch.length} pull requests`
217
- : `Closed ${closed} pull request${closed === 1 ? "" : "s"}`,
218
- ...(failures.length > 0 ? { description: failures.slice(0, 3).join("\n") } : {}),
219
- });
220
- },
221
- [onClosed, runAction],
222
- );
199
+ }),
200
+ );
201
+ const closed = outcomes.filter(Boolean).length;
202
+ toastManager.add({
203
+ type: failures.length > 0 ? "error" : "success",
204
+ title:
205
+ failures.length > 0
206
+ ? `Closed ${closed} of ${batch.length} pull requests`
207
+ : `Closed ${closed} pull request${closed === 1 ? "" : "s"}`,
208
+ ...(failures.length > 0 ? { description: failures.slice(0, 3).join("\n") } : {}),
209
+ });
210
+ };
211
return { close, closingKeys };
212
}
213