fix(ui): prevent infinite redirect if no user (#13615)

Conditionally send the user to the inactivity route if there was a user
but refresh failed. You can get into an infinite loop if you call this
function externally and a redirect is being used in the url.
This commit is contained in:
Jarrod Flesch
2025-08-27 15:43:14 -04:00
committed by GitHub
parent 0a18306599
commit 303381e049

View File

@@ -179,15 +179,17 @@ export function AuthProvider({
return json.user
}
if (user) {
setNewUser(null)
redirectToInactivityRoute()
}
return null
} catch (e) {
toast.error(`Refreshing token failed: ${e.message}`)
return null
}
},
[apiRoute, i18n.language, redirectToInactivityRoute, serverURL, setNewUser, userSlug],
[apiRoute, i18n.language, redirectToInactivityRoute, serverURL, setNewUser, userSlug, user],
)
const logOut = useCallback(async () => {