@devries-cameron20 / t3code Mirror · read-only / commits / a9c0bb6729
Fork 0

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 pull request stack hook compiles without manual memoization (#20620)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Oct 16, 2026 at 22:00 UTC a9c0bb672904c70ea2190cdf7a5bdb27cefda87e
1 file changed +14 -14
apps/web/src/state/usePullRequestStack.ts
+14 -14
@@ -1,5 +1,4 @@
1 import type { EnvironmentId, PullRequestRef } from "@t3tools/contracts";
2 -import { useMemo } from "react";
2 import {
3 savedPullRequestStack,
4 pullRequestStackView,
@@ -8,23 +7,24 @@ import { useThreadShells } from "./entities";
7 import { pullRequestStackAtom } from "./pullRequests";
8 import { useEnvironmentQuery } from "./query";
9
10 +function useSavedPullRequestStack(environmentId: EnvironmentId, reference: PullRequestRef | null) {
11 + "use memo";
12 + const threads = useThreadShells();
13 + return reference === null
14 + ? null
15 + : savedPullRequestStack(
16 + threads
17 + .filter((thread) => thread.environmentId === environmentId)
18 + .flatMap((thread) => thread.pullRequests ?? []),
19 + reference,
20 + );
21 +}
22 +
23 export function usePullRequestStack(
24 environmentId: EnvironmentId,
25 reference: PullRequestRef | null,
26 ) {
15 - const threads = useThreadShells();
16 - const saved = useMemo(
17 - () =>
18 - reference === null
19 - ? null
20 - : savedPullRequestStack(
21 - threads
22 - .filter((thread) => thread.environmentId === environmentId)
23 - .flatMap((thread) => thread.pullRequests ?? []),
24 - reference,
25 - ),
26 - [environmentId, reference, threads],
27 - );
27 + const saved = useSavedPullRequestStack(environmentId, reference);
28 const query = useEnvironmentQuery(
29 reference === null ? null : pullRequestStackAtom({ environmentId, input: reference }),
30 );