Skip to content

Commit aa8c666

Browse files
authored
fix(web): pr merge actions stay visible while the stack refreshes (#17559)
Co-authored-by: maria-rcks <[email protected]>
1 parent 6497246 commit aa8c666

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ export function PullRequestDetailPanel({
823823
const canMergeSinglePullRequest = allowsSinglePullRequestMerge({
824824
supportsStackActions,
825825
hasStack: nativeStack !== null,
826-
stackPending: !nativeStackQuery.isSuccess || nativeStackQuery.isPending,
826+
stackPending: !nativeStackQuery.isFresh,
827827
stackError: nativeStackQuery.error,
828828
});
829829
const activityPending = activityQuery.isPending && activity === null;

‎apps/web/src/components/pullRequest/pullRequestStackSnapshot.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ describe("saved stack navigation", () => {
8888
isFresh: true,
8989
notice: null,
9090
});
91-
expect(pullRequestStackView({ ...query, isPending: true }, saved).isFresh).toBe(false);
91+
expect(pullRequestStackView({ ...query, isPending: true }, saved).isFresh).toBe(true);
92+
expect(pullRequestStackView({ ...query, data: null, isPending: true }, saved)).toMatchObject({
93+
data: null,
94+
isFresh: true,
95+
});
9296
});
9397
});

‎apps/web/src/components/pullRequest/pullRequestStackSnapshot.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ export function savedPullRequestStack(
4747
};
4848
}
4949

50-
/** A fresh absence overrides saved membership; failed refreshes preserve available navigation. */
50+
/**
51+
* A fresh absence overrides saved membership; failed refreshes preserve available navigation.
52+
* A background refresh keeps the last successful lookup fresh, so stack-dependent actions do
53+
* not blink out every time the detail revalidates.
54+
*/
5155
export function pullRequestStackView(
5256
query: {
5357
data: PullRequestStack | null;
@@ -60,7 +64,7 @@ export function pullRequestStackView(
6064
const data = query.isSuccess ? query.data : (query.data ?? saved);
6165
return {
6266
data,
63-
isFresh: query.isSuccess && !query.isPending,
67+
isFresh: query.isSuccess,
6468
notice:
6569
data === null
6670
? null

0 commit comments

Comments
 (0)