mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Implements instant validation for `partialPrefetching`. In this mode, `<Link>` prefetches an App Shell, which cannot access link data, and we need to warn for that. The changes in `instant-validation.tsx` are relatively simple: for an App Shell, we simply use `ShellRuntime` for all the new segments. We might also force them into `Runtime` for the purposes of discriminating dynamic holes. If a hole is present in `ShellRuntime` but disappears in `Runtime`, then we know it's caused by **link data** (as opposed to runtime or dynamic data). I've added some new error messages for this case. Note that the implementation here is incomplete: it uses the chunks from the dev render, which resolves static params in the `Static` stage. We use `ShellRuntime` for validating the App Shell, so as a result, static params are incorrectly included in it and don't trigger link data errors. This will be implemented in a follow-up. Note: It seems like we have some pre-existing bug in build validation where `fallbackParams` aren't populated, so params resolve statically when they shouldn't. I've marked two tests with `// TODO(app-shells): missing fallback params in build validation` so we can follow up and fix those.
24 lines
484 B
TypeScript
24 lines
484 B
TypeScript
import { Instant } from 'next'
|
|
import { RootLayoutTimestamp } from '../../../shared'
|
|
|
|
export const instant: Instant = {
|
|
level: 'experimental-error',
|
|
unstable_samples: [{ params: { lang: 'en' } }],
|
|
}
|
|
|
|
export async function generateStaticParams() {
|
|
return [{ lang: 'en' }]
|
|
}
|
|
|
|
export default async function Layout({ children }: LayoutProps<'/'>) {
|
|
return (
|
|
<html>
|
|
<body>
|
|
<RootLayoutTimestamp />
|
|
<hr />
|
|
{children}
|
|
</body>
|
|
</html>
|
|
)
|
|
}
|