Wrap auth pages in suspense (#327)
This commit is contained in:
parent
ea5b851768
commit
706de5c2fd
@ -1,14 +1,25 @@
|
||||
export const dynamic = 'error'
|
||||
|
||||
import { Suspense } from 'react'
|
||||
import { notFound } from 'next/navigation'
|
||||
import { isFeatureEnabled } from '@lib/featureToggles'
|
||||
import { LoginForm } from './LoginForm'
|
||||
import LoginContent from './LoginContent'
|
||||
|
||||
function LoginPageFallback() {
|
||||
return <div className="flex min-h-screen flex-col bg-gray-50" />
|
||||
}
|
||||
|
||||
export default function LoginPage() {
|
||||
if (!isFeatureEnabled('globalNavigation', '/login')) {
|
||||
notFound()
|
||||
}
|
||||
// 统一返回:容器包裹表单,兼容两边改动
|
||||
return <LoginContent><LoginForm /></LoginContent>
|
||||
return (
|
||||
<Suspense fallback={<LoginPageFallback />}>
|
||||
<LoginContent>
|
||||
<LoginForm />
|
||||
</LoginContent>
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
@ -1,15 +1,24 @@
|
||||
export const dynamic = 'error'
|
||||
|
||||
import { Suspense } from 'react'
|
||||
import { notFound } from 'next/navigation'
|
||||
|
||||
import { isFeatureEnabled } from '@lib/featureToggles'
|
||||
|
||||
import RegisterContent from './RegisterContent'
|
||||
|
||||
function RegisterPageFallback() {
|
||||
return <div className="flex min-h-screen flex-col bg-gray-50" />
|
||||
}
|
||||
|
||||
export default function RegisterPage() {
|
||||
if (!isFeatureEnabled('globalNavigation', '/register')) {
|
||||
notFound()
|
||||
}
|
||||
|
||||
return <RegisterContent />
|
||||
return (
|
||||
<Suspense fallback={<RegisterPageFallback />}>
|
||||
<RegisterContent />
|
||||
</Suspense>
|
||||
)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user