mirror of https://github.com/langgenius/dify.git
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
ddb833e9a1
commit
f7ce52e212
|
|
@ -3,7 +3,7 @@
|
|||
import type { ReactNode } from 'react'
|
||||
import Cookies from 'js-cookie'
|
||||
import { parseAsBoolean, useQueryState } from 'nuqs'
|
||||
import { useCallback, useEffect } from 'react'
|
||||
import { useCallback, useEffect, useState } from 'react'
|
||||
import {
|
||||
EDUCATION_VERIFY_URL_SEARCHPARAMS_ACTION,
|
||||
EDUCATION_VERIFYING_LOCALSTORAGE_ITEM,
|
||||
|
|
@ -29,6 +29,7 @@ export const AppInitializer = ({
|
|||
'oauth_new_user',
|
||||
parseAsBoolean.withOptions({ history: 'replace' }),
|
||||
)
|
||||
const [isReady, setIsReady] = useState(false)
|
||||
const isSetupFinished = useCallback(async () => {
|
||||
try {
|
||||
const setUpStatus = await fetchSetupStatusWithCache()
|
||||
|
|
@ -86,7 +87,11 @@ export const AppInitializer = ({
|
|||
const redirectUrl = resolvePostLoginRedirect()
|
||||
if (redirectUrl) {
|
||||
location.replace(redirectUrl)
|
||||
return
|
||||
}
|
||||
|
||||
// Initialization completed without redirects; safe to render children
|
||||
setIsReady(true)
|
||||
}
|
||||
catch {
|
||||
router.replace('/signin')
|
||||
|
|
@ -94,5 +99,8 @@ export const AppInitializer = ({
|
|||
})()
|
||||
}, [isSetupFinished, router, pathname, searchParams, oauthNewUser])
|
||||
|
||||
if (!isReady)
|
||||
return null
|
||||
|
||||
return children
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue