From 9aa901a286fc14ce7a84e6faa27affcf6423d631 Mon Sep 17 00:00:00 2001 From: Alan Wizemann Date: Mon, 4 May 2026 14:33:22 +0200 Subject: [PATCH] fix(credential-pools): refresh view after OAuth sheet dismiss MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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) --- .../CredentialPools/Views/CredentialPoolsView.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scarf/scarf/Features/CredentialPools/Views/CredentialPoolsView.swift b/scarf/scarf/Features/CredentialPools/Views/CredentialPoolsView.swift index c0ac0d0..00182a5 100644 --- a/scarf/scarf/Features/CredentialPools/Views/CredentialPoolsView.swift +++ b/scarf/scarf/Features/CredentialPools/Views/CredentialPoolsView.swift @@ -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 }