fix(credential-pools): refresh view after OAuth sheet dismiss

The sheet auto-closes 0.8s after `oauthFlow.succeeded` flips, but
the parent view didn't reload — so the expiry badge stayed red and
the `tokenTail` stayed stale until the user hit Reload. Hook
`viewModel.load()` + `probeKeepalive()` into the sheet's
`onDismiss` so the freshly-written `auth.json` lands on screen
immediately. Runs on every dismiss (success or cancel) — `load()`
is cheap and idempotent.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Alan Wizemann
2026-05-04 14:33:22 +02:00
parent 111fe9bb67
commit 9aa901a286
@@ -78,7 +78,17 @@ struct CredentialPoolsView: View {
.onChange(of: coordinator.pendingOAuthReauth) { _, _ in
consumePendingReauth()
}
.sheet(isPresented: $showAddSheet, onDismiss: { reauthInitialProvider = nil }) {
.sheet(isPresented: $showAddSheet, onDismiss: {
// Refresh after every dismiss the OAuth flow rewrites
// `auth.json` on success, but the sheet self-closes
// before SwiftUI re-renders the parent. Without this,
// users had to hit Reload manually after a successful
// re-auth to see the expiry badge clear and the new
// `tokenTail` populate.
reauthInitialProvider = nil
viewModel.load()
probeKeepalive()
}) {
AddCredentialSheet(viewModel: viewModel, initialProvider: reauthInitialProvider) {
showAddSheet = false
}