mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 02:26:37 +00:00
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:
@@ -78,7 +78,17 @@ struct CredentialPoolsView: View {
|
|||||||
.onChange(of: coordinator.pendingOAuthReauth) { _, _ in
|
.onChange(of: coordinator.pendingOAuthReauth) { _, _ in
|
||||||
consumePendingReauth()
|
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) {
|
AddCredentialSheet(viewModel: viewModel, initialProvider: reauthInitialProvider) {
|
||||||
showAddSheet = false
|
showAddSheet = false
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user