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): capture shortcut config compile with the React Compiler (#20511)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 18:53 UTC
350127040a3ba3b86aada6b76b05baaf9b8a286d
2 files changed
+29
-27
apps/web/reactCompiledFiles.ts
+1
@@ -86,4 +86,5 @@ export const REACT_COMPILED_FILES = [
86
"apps/web/src/components/settings/DeviceHostsSettings.tsx",
87
"apps/web/src/components/settings/ProjectSettingsPanel.tsx",
88
"apps/web/src/components/settings/AcpSessionManagementSection.tsx",
89
+ "apps/web/src/components/settings/CaptureShortcutConfig.tsx",
90
] as const;
apps/web/src/components/settings/CaptureShortcutConfig.tsx
+28
-27
@@ -7,7 +7,9 @@ import {
7
import { parseKeybindingShortcut } from "@t3tools/shared/keybindings";
8
import { FileDiff } from "@pierre/diffs/react";
9
import { parseDiffFromFile } from "@pierre/diffs";
10
-import { useMemo, useState } from "react";
10
+import { settlePromise } from "@t3tools/client-runtime/state/runtime";
11
+import * as Cause from "effect/Cause";
12
+import { useState } from "react";
13
import { getDesktopSnapShotBridge } from "../../lib/desktopSnapShot";
14
import { resolveDiffThemeName } from "../../lib/diffRendering";
15
import { useTheme } from "../../hooks/useTheme";
@@ -69,16 +71,13 @@ export function CaptureShortcutConfig({
71
},
72
});
73
const actionBusy = busy || recorder.recording;
72
- const diff = useMemo(
73
- () =>
74
- preview && changed
75
- ? parseDiffFromFile(
76
- { name: preview.path, contents: preview.before },
77
- { name: preview.path, contents: preview.after },
78
- )
79
- : null,
80
- [preview, changed],
81
- );
74
+ const diff =
75
+ preview && changed
76
+ ? parseDiffFromFile(
77
+ { name: preview.path, contents: preview.before },
78
+ { name: preview.path, contents: preview.after },
79
+ )
80
+ : null;
81
const begin = (phase: "reading" | "writing") => {
82
setWorking(phase);
83
onBusyChange?.(true);
@@ -94,28 +93,29 @@ export function CaptureShortcutConfig({
93
setPreview(null);
94
setResult(null);
95
setCustomFile(chooseFile);
97
- try {
98
- setPreview(
99
- await bridge.previewSnapShotConfig({
100
- operation,
101
- chooseFile,
102
- ...(keys?.trim() ? { shortcut: keys.trim() } : {}),
103
- }),
104
- );
105
- } catch (cause) {
96
+ const previewed = await settlePromise(() =>
97
+ bridge.previewSnapShotConfig!({
98
+ operation,
99
+ chooseFile,
100
+ ...(keys?.trim() ? { shortcut: keys.trim() } : {}),
101
+ }),
102
+ );
103
+ if (previewed._tag === "Success") {
104
+ setPreview(previewed.value);
105
+ } else {
106
+ const cause = Cause.squash(previewed.cause);
107
setError({
108
message: "Couldn't prepare the changes. Check Advanced for help.",
109
...(cause instanceof Error ? { detail: cause.message } : {}),
110
});
110
- } finally {
111
- end();
111
}
112
+ end();
113
};
114
const apply = async () => {
115
if (actionBusy || !preview || !bridge?.applySnapShotConfig) return;
116
begin("writing");
117
- try {
118
- const applied = await bridge.applySnapShotConfig(preview.id);
117
+ const saved = await settlePromise(async () => {
118
+ const applied = await bridge.applySnapShotConfig!(preview.id);
119
setResult(applied);
120
await onSaved?.();
121
if (!applied.warning && preview.operation === "install" && onComplete) {
@@ -126,15 +126,16 @@ export function CaptureShortcutConfig({
126
});
127
await onComplete();
128
}
129
- } catch (cause) {
129
+ });
130
+ if (saved._tag === "Failure") {
131
+ const cause = Cause.squash(saved.cause);
132
setError({
133
message: "Couldn't save your shortcut. Review the changes and try again.",
134
...(cause instanceof Error ? { detail: cause.message } : {}),
135
});
136
setPreview(null);
135
- } finally {
136
- end();
137
}
138
+ end();
139
};
140
141
return (