fix: skip PR assignment for main worktree and refine metadata fallback logic

This update modifies the list handler to skip PR assignment for the main worktree, preventing confusion when displaying PRs on the main branch tab. Additionally, the fallback logic for assigning stored metadata is refined to only apply if the PR state is 'OPEN', ensuring more accurate representation of PRs.
This commit is contained in:
Shirone
2026-01-19 00:49:56 +01:00
parent 55a34a9f1f
commit d6300f33ca

View File

@@ -368,6 +368,13 @@ export function createListHandler() {
: new Map<string, WorktreePRInfo>();
for (const worktree of worktrees) {
// Skip PR assignment for the main worktree - it's not meaningful to show
// PRs on the main branch tab, and can be confusing if someone created
// a PR from main to another branch
if (worktree.isMain) {
continue;
}
const metadata = allMetadata.get(worktree.branch);
const githubPR = githubPRs.get(worktree.branch);
@@ -387,8 +394,8 @@ export function createListHandler() {
);
});
}
} else if (metadata?.pr) {
// Fall back to stored metadata (for PRs not in recent GitHub response)
} else if (metadata?.pr && metadata.pr.state === 'OPEN') {
// Fall back to stored metadata only if the PR is still OPEN
worktree.pr = metadata.pr;
}
}