Revalidate PR number when opening prompt picker#506
Conversation
🔍 Multi-Model Code Review — PR #506Revalidate PR number when opening prompt picker CI StatusFindings🟡 MODERATE — Popup blocked ~1–2s on every open (3/3 reviewers)File:
The existing pattern in Suggestion: Use fire-and-forget ( 🟡 MODERATE —
|
| # | Finding | Status |
|---|---|---|
| 1 | 🟡 Popup blocked ~1–2s on every open | ✅ FIXED — Changed await FetchPrUrlAsync(dir) to _ = FetchPrUrlAsync(dir) (fire-and-forget). Popup opens instantly with cached _prLabel; background fetch updates via StateHasChanged if PR number changes. |
| 2 | 🟡 _prLabel not reset when branch has no PR |
✅ FIXED — Added else { _prLabel = "PR"; } in FetchPrUrlAsync when _prUrl is null. Stale PR numbers are now cleared. |
| 3 | 🟢 Unconditional cache invalidation | ✅ ADDRESSED — Kept unconditional invalidation (intentional: branch can change without directory changing), but added detailed comment explaining why. Fire-and-forget eliminates the user-visible latency cost. |
Test Results
✅ 3,155 tests pass (0 failed, 0 skipped)
Updated Recommendation
✅ Approve — all findings addressed. Popup no longer blocks, stale PR labels cleared, cache invalidation explained.
When the user opens the prompt picker, invalidate the PrLinkService cache and re-fetch the current branch's PR number. This ensures the autofilled PR context is accurate even after branch switches. Also fix WsBridgeIntegrationTests: ChangeModelAsync gained a reasoningEffort parameter, so pass CancellationToken as named arg. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ve comments - Change await FetchPrUrlAsync to fire-and-forget so the prompt picker opens instantly instead of blocking ~1-2s on subprocess spawns - Reset _prLabel to "PR" when FetchPrUrlAsync returns null (no PR for branch), preventing stale PR numbers from being autofilled - Add detailed comment explaining why unconditional invalidation is needed (branch can change without directory changing) 3,155 tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
6716f81 to
d7e9ca2
Compare
When the user opens the prompt picker, invalidate the PrLinkService cache and re-fetch the current branch's PR. This ensures the autofilled PR context is accurate after branch switches.
Also fixes WsBridgeIntegrationTests build error (ChangeModelAsync signature changed with new reasoningEffort parameter).
Testing: All 3,129 tests pass.