mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +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.
27 lines
620 B
TypeScript
27 lines
620 B
TypeScript
import { cacheLife } from 'next/cache'
|
|
import { DebugLinks } from '../shared'
|
|
import { Instant } from 'next'
|
|
|
|
// Skip repeatedly running instant validation on index pages during tests
|
|
export const instant: Instant = {
|
|
unstable_disableValidation: true,
|
|
}
|
|
|
|
export default async function Page() {
|
|
'use cache'
|
|
cacheLife('minutes')
|
|
return (
|
|
<main>
|
|
<h2>Static</h2>
|
|
<ul>
|
|
<li>
|
|
<DebugLinks href="/default/static/valid-blocked-children" />
|
|
</li>
|
|
<li>
|
|
<DebugLinks href="/default/static/valid-blocking-inside-static" />
|
|
</li>
|
|
</ul>
|
|
</main>
|
|
)
|
|
}
|