Unverified Commit fda6986b authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

[test] Prerendering HTTP access fallback pages with Cache Components (#93987)

parent 3e97d89d
'use client'
import { useSearchParams } from 'next/navigation'
export default function Forbidden() {
const searchParams = useSearchParams()
return <p>forbidden {searchParams.get('foo')}</p>
}
import { forbidden } from 'next/navigation'
export function generateStaticParams() {
return [{ slug: 'allowed' }, { slug: 'forbidden' }]
}
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
if (slug === 'allowed') {
return <p>hello world</p>
}
forbidden()
}
export default function Root({ children }: { children: React.ReactNode }) {
return (
<html>
<body>{children}</body>
</html>
)
}
'use client'
import { useSearchParams } from 'next/navigation'
export default function NotFound() {
const searchParams = useSearchParams()
return <p>not found {searchParams.get('foo')}</p>
}
import { notFound } from 'next/navigation'
export function generateStaticParams() {
return [{ slug: 'found' }, { slug: 'not-found' }]
}
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
if (slug === 'found') {
return <p>hello world</p>
}
notFound()
}
import { unauthorized } from 'next/navigation'
export function generateStaticParams() {
return [{ slug: 'authorized' }, { slug: 'unauthorized' }]
}
export default async function Page({
params,
}: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
if (slug === 'authorized') {
return <p>hello world</p>
}
unauthorized()
}
'use client'
import { useSearchParams } from 'next/navigation'
export default function Unauthorized() {
const searchParams = useSearchParams()
return <p>unauthorized {searchParams.get('foo')}</p>
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
cacheComponents: true,
experimental: {
authInterrupts: true,
},
}
module.exports = nextConfig
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment