fix(web): pr merge actions stay visible while the stack refreshes (#17559)

Co-authored-by: maria-rcks <[email protected]>
This commit is contained in:
mariaandmaria-rcks authored and GitHub committed 2026-10-09 15:47:53 -03:00
1 parent 64972461c0
commit aa8c6662e2
3 files changed
+12 -4

No files matched your search

@@ -823,7 +823,7 @@ export function PullRequestDetailPanel({
const canMergeSinglePullRequest = allowsSinglePullRequestMerge({
supportsStackActions,
hasStack: nativeStack !== null,
stackPending: !nativeStackQuery.isSuccess || nativeStackQuery.isPending,
stackPending: !nativeStackQuery.isFresh,
stackError: nativeStackQuery.error,
});
const activityPending = activityQuery.isPending && activity === null;
@@ -88,6 +88,10 @@ describe("saved stack navigation", () => {
isFresh: true,
notice: null,
});
expect(pullRequestStackView({ ...query, isPending: true }, saved).isFresh).toBe(false);
expect(pullRequestStackView({ ...query, isPending: true }, saved).isFresh).toBe(true);
expect(pullRequestStackView({ ...query, data: null, isPending: true }, saved)).toMatchObject({
data: null,
isFresh: true,
});
});
});
@@ -47,7 +47,11 @@ export function savedPullRequestStack(
};
}
/** A fresh absence overrides saved membership; failed refreshes preserve available navigation. */
/**
* A fresh absence overrides saved membership; failed refreshes preserve available navigation.
* A background refresh keeps the last successful lookup fresh, so stack-dependent actions do
* not blink out every time the detail revalidates.
*/
export function pullRequestStackView(
query: {
data: PullRequestStack | null;
@@ -60,7 +64,7 @@ export function pullRequestStackView(
const data = query.isSuccess ? query.data : (query.data ?? saved);
return {
data,
isFresh: query.isSuccess && !query.isPending,
isFresh: query.isSuccess,
notice:
data === null
? null