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, 06:45 UTC
perf(web): the project scripts control compiles without manual memoization (#20599)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 22:02 UTC
dec20cedc8145da7bed936a708bc96d9e363c402
1 file changed
+12
-24
apps/web/src/components/ProjectScriptsControl.tsx
+12
-24
@@ -4,7 +4,6 @@ import {
4
type EnvironmentId,
5
type ProjectScript,
6
type T3ProjectFileScript,
7
- type ResolvedKeybindingsConfig,
7
} from "@t3tools/contracts";
8
import { useAtomValue } from "@effect/atom-react";
9
import { DEFAULT_RESOLVED_KEYBINDINGS } from "@t3tools/shared/keybindings";
@@ -14,7 +13,7 @@ import {
13
} from "@t3tools/client-runtime/state/runtime";
14
import { projectScriptMenuLabel } from "@t3tools/shared/projectScripts";
15
import { ChevronDownIcon, DownloadIcon, PlusIcon, SettingsIcon, WrenchIcon } from "lucide-react";
17
-import React, { useCallback, useMemo, useState } from "react";
16
+import React, { useState } from "react";
17
18
import { commandForProjectScript, primaryProjectScript } from "~/projectScripts";
19
import { shortcutLabelForCommand } from "~/keybindings";
@@ -105,24 +104,16 @@ export default function ProjectScriptsControl({
104
}
105
const [editorRequest, setEditorRequest] = useState<ProjectScriptEditorRequest | null>(null);
106
108
- const primaryScript = useMemo(() => {
109
- if (preferredScriptId) {
110
- const preferred = scripts.find((script) => script.id === preferredScriptId);
111
- if (preferred) return preferred;
112
- }
113
- return primaryProjectScript(scripts);
114
- }, [preferredScriptId, scripts]);
115
- const importableScripts = useMemo(
116
- () =>
117
- fileScripts.filter(
118
- (fileScript) =>
119
- !scripts.some(
120
- (script) =>
121
- script.command === fileScript.command ||
122
- script.name.toLowerCase() === fileScript.name.toLowerCase(),
123
- ),
107
+ const primaryScript =
108
+ (preferredScriptId ? scripts.find((script) => script.id === preferredScriptId) : undefined) ??
109
+ primaryProjectScript(scripts);
110
+ const importableScripts = fileScripts.filter(
111
+ (fileScript) =>
112
+ !scripts.some(
113
+ (script) =>
114
+ script.command === fileScript.command ||
115
+ script.name.toLowerCase() === fileScript.name.toLowerCase(),
116
),
125
- [fileScripts, scripts],
117
);
118
119
const openAddDialog = () => {
@@ -135,11 +126,8 @@ export default function ProjectScriptsControl({
126
setEditorRequest(editorRequestForScript(script, keybindings));
127
};
128
138
- const submitScript = useCallback(
139
- (scriptId: string | null, input: NewProjectScriptInput) =>
140
- scriptId === null ? onAddScript(input) : onUpdateScript(scriptId, input),
141
- [onAddScript, onUpdateScript],
142
- );
129
+ const submitScript = (scriptId: string | null, input: NewProjectScriptInput) =>
130
+ scriptId === null ? onAddScript(input) : onUpdateScript(scriptId, input);
131
132
const importFileScript = async (fileScript: T3ProjectFileScript) => {
133
const payload: NewProjectScriptInput = {