The best way to control Claude Code, Codex and more from any computer or phone
refactor(web): the pull request thread dialog keeps its caching without "use memo" hooks (#20742)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 16, 2026 at 23:20 UTC
0ad3fd64360ef6942ad4b76ece2d8fdd28432a11
1 file changed
+6
-11
apps/web/src/components/PullRequestThreadDialog.tsx
+6
-11
@@ -44,13 +44,6 @@ interface PullRequestThreadDialogProps {
44
onPrepared: (input: { branch: string; worktreePath: string | null }) => Promise<void> | void;
45
}
46
47
-// The prepare action keys on this scope, and the compiler would rebuild it every
48
-// render because hooks run after it.
49
-function useSourceControlScope(environmentId: EnvironmentId, cwd: string | null) {
50
- "use memo";
51
- return { environmentId, cwd };
52
-}
53
-
47
function pullRequestStatusTone(state: string | undefined): string {
48
switch (state) {
49
case "merged":
@@ -108,17 +101,19 @@ export function PullRequestThreadDialog({
101
102
const parsedReference = parsePullRequestReference(reference);
103
const parsedDebouncedReference = parsePullRequestReference(debouncedReference);
111
- const sourceControlScope = useSourceControlScope(environmentId, cwd);
104
const pullRequestResolution = usePullRequestResolution({
113
- ...sourceControlScope,
105
+ environmentId,
106
+ cwd,
107
reference: open ? parsedDebouncedReference : null,
108
});
109
const cachedPullRequest =
110
readCachedPullRequestResolution({
118
- ...sourceControlScope,
111
+ environmentId,
112
+ cwd,
113
reference: parsedReference,
114
})?.pullRequest ?? null;
121
- const preparePullRequestThreadAction = usePreparePullRequestThreadAction(sourceControlScope);
115
+ // The prepare action keys on this scope object, so it only ever reaches the hook.
116
+ const preparePullRequestThreadAction = usePreparePullRequestThreadAction({ environmentId, cwd });
117
const canOperateThread = useEnvironmentScope(environmentId, AuthOrchestrationOperateScope);
118
119
const liveResolvedPullRequest =