fix: address pr-bug-scan findings from #1466

Cleared selectedRepoSlug synchronously at the top of the resolution effect so a repo switch invalidates the prior slug until the new IPC call resolves, preventing cross-repo PR mislinks during the in-
This commit is contained in:
orca-bug-scan-bot
2026-05-06 20:10:58 -07:00
parent 3b0dda595d
commit 985bad8a02
+6 -1
View File
@@ -378,8 +378,13 @@ export function useComposerState(options: UseComposerStateOptions): UseComposerS
)
const selectedRepoPath = selectedRepo?.path
useEffect(() => {
// Why: clear synchronously on every change so a repo switch (path A → B)
// invalidates the prior slug until the new IPC call resolves. Without
// this, effectiveLinkedPR would accept a PR URL whose slug matches the
// previous repo during the in-flight window — exactly the cross-repo
// mislink the slug guard is meant to prevent.
setSelectedRepoSlug(null)
if (!selectedRepoPath) {
setSelectedRepoSlug(null)
return
}
let cancelled = false