fix: signin page stuck on loading when refresh token valid but access token expired (#30675)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
yyh 2026-01-07 14:20:38 +08:00 committed by GitHub
parent e335cd0ef4
commit 160b4d194b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -28,7 +28,8 @@ const NormalForm = () => {
const message = decodeURIComponent(searchParams.get('message') || '')
const invite_token = decodeURIComponent(searchParams.get('invite_token') || '')
const [isInitCheckLoading, setInitCheckLoading] = useState(true)
const isLoading = isCheckLoading || loginData?.logged_in || isInitCheckLoading
const [isRedirecting, setIsRedirecting] = useState(false)
const isLoading = isCheckLoading || isInitCheckLoading || isRedirecting
const { systemFeatures } = useGlobalPublicStore()
const [authType, updateAuthType] = useState<'code' | 'password'>('password')
const [showORLine, setShowORLine] = useState(false)
@ -40,6 +41,7 @@ const NormalForm = () => {
const init = useCallback(async () => {
try {
if (isLoggedIn) {
setIsRedirecting(true)
const redirectUrl = resolvePostLoginRedirect(searchParams)
router.replace(redirectUrl || '/apps')
return

View File

@ -221,13 +221,12 @@ export const useIsLogin = () => {
await get('/account/profile', {}, {
silent: true,
})
}
catch (e: any) {
if (e.status === 401)
return { logged_in: false }
return { logged_in: true }
}
return { logged_in: true }
catch {
// Any error (401, 500, network error, etc.) means not logged in
return { logged_in: false }
}
},
})
}