Skip to content

Commit 8c3958f

Browse files
only21milcodex
andcommitted
fix(web): wait for fresh diff pages in review guides
Co-Authored-By: GPT-6.1 Sol <[email protected]>
1 parent 6333519 commit 8c3958f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎apps/web/src/components/pullRequest/guide/useGuideDiffFiles.browser.test.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { act, render } from "../../../../test/render";
88
const state = vi.hoisted(() => ({
99
pages: new Map<string | null, Atom.Writable<AsyncResult.AsyncResult<PullRequestDiffResult>>>(),
1010
}));
11-
vi.mock(import("~/state/pullRequests"), () => ({
11+
vi.mock("~/state/pullRequests", () => ({
1212
pullRequestEnvironment: {
1313
diff: ({ input }: { input: { cursor?: string } }) => state.pages.get(input.cursor ?? null)!,
1414
},

‎apps/web/src/components/pullRequest/guide/useGuideDiffFiles.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export function useGuideDiffFiles({
5050
: null,
5151
);
5252

53-
// Each page is folded in once, during the render that first sees it.
53+
// Cached pages stay subscribed until revalidation finishes. Fold each settled page once.
5454
const data = query.data;
55-
if (data !== null && !current.done && current.folded !== data) {
55+
if (data !== null && !query.isPending && !current.done && current.folded !== data) {
5656
const parsed = getRenderablePatch(
5757
data.patch,
5858
`pull-request-guide:${key}:${current.cursor ?? "first"}`,

0 commit comments

Comments
 (0)