Skip to content

Commit 8d46dc7

Browse files
refactor(web): the pull request thread dialog keeps its caching without "use memo" hooks
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 16e6a6a commit 8d46dc7

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎apps/web/src/components/PullRequestThreadDialog.tsx‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ interface PullRequestThreadDialogProps {
4444
onPrepared: (input: { branch: string; worktreePath: string | null }) => Promise<void> | void;
4545
}
4646

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-
5447
function pullRequestStatusTone(state: string | undefined): string {
5548
switch (state) {
5649
case "merged":
@@ -108,17 +101,19 @@ export function PullRequestThreadDialog({
108101

109102
const parsedReference = parsePullRequestReference(reference);
110103
const parsedDebouncedReference = parsePullRequestReference(debouncedReference);
111-
const sourceControlScope = useSourceControlScope(environmentId, cwd);
112104
const pullRequestResolution = usePullRequestResolution({
113-
...sourceControlScope,
105+
environmentId,
106+
cwd,
114107
reference: open ? parsedDebouncedReference : null,
115108
});
116109
const cachedPullRequest =
117110
readCachedPullRequestResolution({
118-
...sourceControlScope,
111+
environmentId,
112+
cwd,
119113
reference: parsedReference,
120114
})?.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 });
122117
const canOperateThread = useEnvironmentScope(environmentId, AuthOrchestrationOperateScope);
123118

124119
const liveResolvedPullRequest =

0 commit comments

Comments
 (0)