fix: address pr-bug-scan findings from #1385 (#1462)

Wrapped FirstLaunchBanner handlers' bodies in try/finally so inFlight resets even if fetchSettings rejects, preventing the banner from going permanently inert.

Co-authored-by: orca-bug-scan-bot <orca-bug-scan-bot@stably.ai>
This commit is contained in:
buf0-bot[bot] 2026-05-05 15:25:56 -07:00 committed by GitHub
parent 5de1a2c69c
commit a32b120c11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 6 deletions

View File

@ -71,9 +71,17 @@ export function FirstLaunchBanner({
// banner helper text until the next full relaunch. Mirror
// PrivacyPane's handleToggle pattern which refetches for the same
// reason before surfacing UI changes.
await acknowledgeBanner()
await fetchSettings()
onResolve()
try {
await acknowledgeBanner()
await fetchSettings()
onResolve()
} finally {
// Why: if `fetchSettings` rejects (IPC error during shutdown,
// settings file lock, etc.), `onResolve` never runs and the banner
// stays mounted. Without resetting `inFlight`, every button stays
// permanently disabled for the rest of the session.
setInFlight(false)
}
}
const handleTurnOff = async (): Promise<void> => {
@ -86,9 +94,13 @@ export function FirstLaunchBanner({
// `setOptIn` (client.ts). The renderer just needs to route through
// `telemetrySetOptIn(false)` so the IPC handler derives the correct
// `via` and fires the event.
await telemetrySetOptIn(false)
await fetchSettings()
onResolve()
try {
await telemetrySetOptIn(false)
await fetchSettings()
onResolve()
} finally {
setInFlight(false)
}
}
return (