| author | |
| committer | |
| log | aa8c6662e212a4307bd4e585661da99a358e46d4 |
| tree | 482c56bfd799e48001016f3d1f8333805886ed8c |
| parent | 64972461c0606a4eafdd3cd08056155b6a2fea95 |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: maria-rcks <254055478+maria-rcks@users.noreply.github.com>3 files changed, 12 insertions(+), 4 deletions(-)
apps/web/src/components/pullRequest/PullRequestDetailPanel.tsx+1-1| ... | @@ -823,7 +823,7 @@ export function PullRequestDetailPanel({ | ... | @@ -823,7 +823,7 @@ export function PullRequestDetailPanel({ |
| 823 | const canMergeSinglePullRequest = allowsSinglePullRequestMerge({ | 823 | const canMergeSinglePullRequest = allowsSinglePullRequestMerge({ |
| 824 | supportsStackActions, | 824 | supportsStackActions, |
| 825 | hasStack: nativeStack !== null, | 825 | hasStack: nativeStack !== null, |
| 826 | stackPending: !nativeStackQuery.isSuccess || nativeStackQuery.isPending, | 826 | stackPending: !nativeStackQuery.isFresh, |
| 827 | stackError: nativeStackQuery.error, | 827 | stackError: nativeStackQuery.error, |
| 828 | }); | 828 | }); |
| 829 | const activityPending = activityQuery.isPending && activity === null; | 829 | const activityPending = activityQuery.isPending && activity === null; |
apps/web/src/components/pullRequest/pullRequestStackSnapshot.test.ts+5-1| ... | @@ -88,6 +88,10 @@ describe("saved stack navigation", () => { | ... | @@ -88,6 +88,10 @@ describe("saved stack navigation", () => { |
| 88 | isFresh: true, | 88 | isFresh: true, |
| 89 | notice: null, | 89 | notice: null, |
| 90 | }); | 90 | }); |
| 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 | }); | ||
| 92 | }); | 96 | }); |
| 93 | }); | 97 | }); |
apps/web/src/components/pullRequest/pullRequestStackSnapshot.ts+6-2| ... | @@ -47,7 +47,11 @@ export function savedPullRequestStack( | ... | @@ -47,7 +47,11 @@ export function savedPullRequestStack( |
| 47 | }; | 47 | }; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 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 | */ | ||
| 51 | export function pullRequestStackView( | 55 | export function pullRequestStackView( |
| 52 | query: { | 56 | query: { |
| 53 | data: PullRequestStack | null; | 57 | data: PullRequestStack | null; |
| ... | @@ -60,7 +64,7 @@ export function pullRequestStackView( | ... | @@ -60,7 +64,7 @@ export function pullRequestStackView( |
| 60 | const data = query.isSuccess ? query.data : (query.data ?? saved); | 64 | const data = query.isSuccess ? query.data : (query.data ?? saved); |
| 61 | return { | 65 | return { |
| 62 | data, | 66 | data, |
| 63 | isFresh: query.isSuccess && !query.isPending, | 67 | isFresh: query.isSuccess, |
| 64 | notice: | 68 | notice: |
| 65 | data === null | 69 | data === null |
| 66 | ? null | 70 | ? null |