Skip to content
Source
Sign inSign up
pingdotgg/t3code

Preserve pull request status across branch checkouts #5407

Closedjuliusmarmingewants to merge 2 commits intomain fromt3code/0b776cceopened View on GitHub

Showing 19 changed files with 64 additions and 4 deletions (loading 16).

x
0 of 19 viewed, 19 left
20 additions and 4 deletionsapps/mobile/src/state/use-thread-pr.tsModified
View file
@@ -15,6 +15,10 @@
* (environmentId, cwd) by the atom family, so many rows on the same worktree
* or project root share one stream — and virtualization means only visible
* rows subscribe at all.
+ *
+ * Keyed by the thread's recorded branch, not the current checkout: the
+ * streamed status is the fast path while the checkout matches, and a
+ * branch-keyed lookup keeps the badge alive once the checkout moves away.
*/
export function useThreadPr(
thread: EnvironmentThreadShell,
@@ -29,13 +33,25 @@
})
: null,
);
+ const branchPr = useEnvironmentQuery(
+ thread.branch !== null && cwd !== null
+ ? vcsEnvironment.branchPr({
+ environmentId: thread.environmentId,
+ input: { cwd, branch: thread.branch },
+ })
+ : null,
+ );
​
const status = gitStatus.data;
- if (status === null || thread.branch === null || status.refName !== thread.branch) {
- return null;
+ // When the status describes the thread's own branch it is authoritative
+ // about that branch's PR — including when it reports none, so this must not