mirror of
https://github.com/stablyai/orca.git
synced 2026-09-28 08:02:43 +00:00
fix: retry transient auth readiness failures
This commit is contained in:
@@ -59,14 +59,24 @@ export function UnexpectedSignoutCard(): React.JSX.Element | null {
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false
|
||||
void useAppStore
|
||||
.getState()
|
||||
.fetchOrcaProfileAuthStatus()
|
||||
.then((status) => {
|
||||
if (!cancelled && status != null) {
|
||||
setAuthRefreshReady(true)
|
||||
}
|
||||
})
|
||||
let attempts = 0
|
||||
const refresh = (): void => {
|
||||
attempts += 1
|
||||
void useAppStore
|
||||
.getState()
|
||||
.fetchOrcaProfileAuthStatus()
|
||||
.then((status) => {
|
||||
if (cancelled) {
|
||||
return
|
||||
}
|
||||
if (status != null) {
|
||||
setAuthRefreshReady(true)
|
||||
} else if (attempts < 3) {
|
||||
window.setTimeout(refresh, 500)
|
||||
}
|
||||
})
|
||||
}
|
||||
refresh()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user