fix: remove reload-based stale build recovery to stop login loop

window.location.reload() causes infinite loops when the CDN keeps
serving cached assets. Instead, silently treat Server Action failures
as no-session — the OAuth flow uses full navigations (window.location.href)
which naturally fetch fresh content from the server on return.
This commit is contained in:
Usman Baig
2026-03-07 20:02:58 +01:00
parent 6338d1dfe7
commit ad806e0427
2 changed files with 5 additions and 30 deletions

View File

@@ -26,14 +26,7 @@ function AuthCallbackContent() {
try {
result = await exchangeAuthCode(code, codeVerifier, redirectUri)
} catch {
// * Stale build — cached JS has old Server Action hashes. Hard reload once to fix.
const key = 'pulse_reload_for_stale_build'
if (!sessionStorage.getItem(key)) {
sessionStorage.setItem(key, '1')
window.location.reload()
return
}
sessionStorage.removeItem(key)
// * Stale build or network error — show error so user can retry via full navigation
setError('Something went wrong. Please try logging in again.')
return
}