Files
Andrew ClarkandGitHub dfa7f4f713 Attempt static prefetch before resorting to runtime (#96095)
If we're reasonably confident that a segment can be prefetched
statically without omitting data that would have been included during a
runtime prefetch (e.g. cookies), the client should attempt prefetch the
segment statically instead of going straight to a runtime request.

The decision for whether to do this is based on the
ShouldAttemptStaticPrefetch added in previous steps.

If it turns out the static response is not sufficient, then it will fall
back to a runtime request.

This makes prefetching cheaper for pages that are fully statically
renderable. We can make the optimization better in the future with more
reliable per-segment computation of the ShouldAttemptStaticPrefetch, but
the current approach should at least work for fully static pages, which
is what's most important.

This optimization applies during both the Shell phase and the
Speculative phase of the prefetching algorithm.
2026-07-28 11:51:29 -04:00

80 lines
2.2 KiB
TypeScript

import { LinkAccordion } from '../components/link-accordion'
export default function Page() {
return (
<div>
<h1 id="home">Prefetch inlining home</h1>
<ul>
<li>
<LinkAccordion href="/test-small-chain">Small chain</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-deep/a/b/c">Deep chain</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-outlined">Outlined</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-restart/large-middle/after">
Restart
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-parallel">Parallel</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-dynamic/hello">Dynamic</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-runtime-bailout">
Runtime bailout
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-runtime-bailout" prefetch={true}>
Runtime bailout (prefetch=true)
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-stale-hints/nested/deep">
Stale hints
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-instant-false-root">
Instant false root
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-runtime-passthrough/inner">
Runtime passthrough
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-instant-false-passthrough/inner">
Instant false passthrough
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-runtime-parallel/inner">
Runtime parallel
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-independent-head/a">
Independent head A
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-independent-head/b">
Independent head B
</LinkAccordion>
</li>
<li>
<LinkAccordion href="/test-not-found/exists">Not found</LinkAccordion>
</li>
</ul>
</div>
)
}