Keep PR refreshes anchored to cached review numbers (#2541)
- Use fallback PR numbers after branch lookup misses, including detached HEAD - Preserve review cards for forked or deleted-head PRs across manual refreshes - Clear stale GitHub PR cache entries when unlinking worktree review metadata
This commit is contained in:
+11
-2
@@ -166,13 +166,22 @@ export function registerGitHubHandlers(store: Store, stats: StatsCollector): voi
|
||||
|
||||
ipcMain.handle(
|
||||
'gh:prForBranch',
|
||||
async (_event, args: { repoPath: string; branch: string; linkedPRNumber?: number | null }) => {
|
||||
async (
|
||||
_event,
|
||||
args: {
|
||||
repoPath: string
|
||||
branch: string
|
||||
linkedPRNumber?: number | null
|
||||
fallbackPRNumber?: number | null
|
||||
}
|
||||
) => {
|
||||
const repo = assertRegisteredRepo(args, store)
|
||||
const pr = await getPRForBranch(
|
||||
repo.path,
|
||||
args.branch,
|
||||
args.linkedPRNumber ?? null,
|
||||
repoConnectionId(repo)
|
||||
repoConnectionId(repo),
|
||||
args.linkedPRNumber == null ? (args.fallbackPRNumber ?? null) : null
|
||||
)
|
||||
// Emit pr_created when a PR is first detected for a branch.
|
||||
// Why here: the renderer polls gh:prForBranch to check PR status per worktree.
|
||||
|
||||
Reference in New Issue
Block a user