mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Based on: - #87134 --- hmr-refresh-reducer is identical to refresh-reducer except for the fact that it doesn't evict the prefetch cache. So this refactors both implementations to call the same shared function.
31 lines
734 B
TypeScript
31 lines
734 B
TypeScript
import { connection } from 'next/server'
|
|
import { Suspense } from 'react'
|
|
|
|
export async function generateStaticParams() {
|
|
return [{ param: 'a' }, { param: 'b' }]
|
|
}
|
|
|
|
async function DynamicContent({ children }: { children: React.ReactNode }) {
|
|
await connection()
|
|
return children
|
|
}
|
|
|
|
export default async function Page({
|
|
params,
|
|
}: PageProps<'/mismatching-prefetch/dynamic-page/[param]'>) {
|
|
const { param } = await params
|
|
return (
|
|
<Suspense
|
|
fallback={
|
|
<div id={`dynamic-page-loading-${param}`}>{`Loading ${param}...`}</div>
|
|
}
|
|
>
|
|
<DynamicContent>
|
|
<div
|
|
id={`dynamic-page-content-${param}`}
|
|
>{`Dynamic page ${param}`}</div>
|
|
</DynamicContent>
|
|
</Suspense>
|
|
)
|
|
}
|