The best way to control Claude Code, Codex and more from any computer or phone
perf(web): the project file scripts hook compiles without manual memoization (#20632)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 21:58 UTC
452d032a2a2e47bced99ba662a1eda18f9edd116
1 file changed
+12
-15
apps/web/src/hooks/useT3ProjectFileScripts.ts
+12
-15
@@ -5,7 +5,6 @@ import {
5
type T3ProjectFileScript,
6
} from "@t3tools/contracts";
7
import { parseT3ProjectFile } from "@t3tools/shared/t3ProjectFile";
8
-import { useMemo } from "react";
8
9
import { useProjectFileQuery } from "~/components/files/projectFilesQueryState";
10
@@ -24,20 +23,18 @@ export function useT3ProjectFileState(
23
const query = useProjectFileQuery(environmentId, cwd ?? "", T3_PROJECT_FILE_NAME, cwd !== null);
24
const contents = query.data && !query.data.truncated ? query.data.contents : null;
25
const isPending = query.isPending;
27
- return useMemo(() => {
28
- if (contents === null) {
29
- return {
30
- status: isPending ? "loading" : "missing",
31
- file: null,
32
- scripts: NO_SCRIPTS,
33
- } as const;
34
- }
35
- const file = parseT3ProjectFile(contents);
36
- if (file === null) {
37
- return { status: "invalid", file: null, scripts: NO_SCRIPTS } as const;
38
- }
39
- return { status: "valid", file, scripts: file.scripts ?? NO_SCRIPTS } as const;
40
- }, [contents, isPending]);
26
+ if (contents === null) {
27
+ return {
28
+ status: isPending ? "loading" : "missing",
29
+ file: null,
30
+ scripts: NO_SCRIPTS,
31
+ } as const;
32
+ }
33
+ const file = parseT3ProjectFile(contents);
34
+ if (file === null) {
35
+ return { status: "invalid", file: null, scripts: NO_SCRIPTS } as const;
36
+ }
37
+ return { status: "valid", file, scripts: file.scripts ?? NO_SCRIPTS } as const;
38
}
39
40
export function useT3ProjectFileScripts(