-
-
Notifications
You must be signed in to change notification settings - Fork 88
test(next): preview Next.js 16.3 instant navigations [DO NOT MERGE] #259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
arzafran
wants to merge
31
commits into
main
Choose a base branch
from
next/16.3-preview
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 9 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
de3a6c4
feat: adopt Next.js 16.3 preview + partialPrefetching (instant naviga…
arzafran b5be0d7
test(next): add instant-nav demo routes and 16.3 turbopack build flags
arzafran 3ed2755
Merge remote-tracking branch 'origin/main' into next/16.3-preview
arzafran a675dfc
Merge remote-tracking branch 'origin/main' into next/16.3-preview
arzafran eba6df6
chore: refresh next@preview to 16.3.0-preview.6 and merge main
arzafran 8ba6b66
merge main (starter hardening + polish + deps)
arzafran b26acc9
merge main into 16.3 preview
arzafran 601e92c
fix(form): use SubmitEvent instead of the deprecated FormEvent
arzafran c9bf700
chore: track next@preview.8
arzafran 6be6934
fix(demo): use min-h-dvh in the instant-nav demo routes
arzafran 3b5f66a
docs(demo): spell out the dynamic route example paths in full
arzafran 63fa53d
fix(demo): announce the streamed panel's loading state, drop stray co…
arzafran ac7de99
fix: make the prepare script safe in linked worktrees (#304)
arzafran 710af1a
Merge remote-tracking branch 'origin/main' into next/16.3-preview
arzafran 3402c6f
chore: track next@preview.9
arzafran 1b2d42c
Merge remote-tracking branch 'origin/main' into next/16.3-preview
arzafran 170683a
Merge main into next/16.3-preview and bump to 16.3.0-preview.10
arzafran 59e24f1
perf(hooks): let the React Compiler optimize useDeviceDetection again
arzafran d68fa40
perf: cache Intl formatters, skip the barrels, stop walking lists twice
arzafran 5b259fd
perf(next): turn on the rest of the 16.3 instant-navigation cluster
arzafran a23dcd1
perf(webgl): hold sim instances in refs and drop the effect-event han…
arzafran db66af7
perf(webgl,theatre): clear the last two React Compiler errors
arzafran fe70b46
chore(react-doctor): stop the dead-code pass reporting a template as …
arzafran d557a2f
a11y: give every form control a name, and use <output> for loading re…
arzafran 381957c
perf(demo): resolve params and connection() together
arzafran d43181f
chore(react-doctor): scope the Theatre and theme findings by rule, no…
arzafran 315adf1
fix(form): fire onSuccess/onError from the action, not from an effect
arzafran 2939d79
feat(scripts): add a client-side navigation benchmark
arzafran ef8cd4e
feat(scripts): add a re-render cost benchmark, and correct the record
arzafran 3ce30ad
feat(scripts): add a 404-to-home nav scenario so bench:nav runs on main
arzafran 7474b74
Merge main into next/16.3-preview after the cherry-pick
arzafran File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # instant-nav-demo — throwaway | ||
|
|
||
| These routes exist ONLY on the `next/16.3-preview` branch to exercise Next.js | ||
| 16.3 Instant Navigations (`partialPrefetching`) on a real deploy. They are NOT | ||
| starter content and must never merge to `main`. | ||
|
|
||
| - `page.tsx` — hub linking to the demo routes (prefetch fires on hover/viewport) | ||
| - `fast/` — synchronous route, the prefetched shell is the whole page | ||
| - `slow/` — shell paints immediately; an inner `<Suspense>` panel streams in | ||
| after a delay (`connection()` + artificial wait) — partial prerendering | ||
| - `[item]/` — dynamic route that suspends at the top level, so its `loading.tsx` | ||
| shell is shown on the way in and reused identically for every param value | ||
| (`/instant-nav-demo/alpha`, `/bravo`, `/charlie`) | ||
|
|
||
| Reach it on the preview at `/instant-nav-demo`. Delete this whole folder before | ||
| adopting anything from this branch. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export default function Loading() { | ||
| return ( | ||
| <div | ||
| role="status" | ||
| aria-busy="true" | ||
| className="flex min-h-screen flex-col items-center justify-center gap-3 font-mono" | ||
| > | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| <span className="sr-only">Loading item</span> | ||
| <div className="w-40 animate-pulse space-y-2"> | ||
| <div className="h-2 rounded bg-current opacity-20" /> | ||
| <div className="h-2 w-3/4 rounded bg-current opacity-20" /> | ||
| <div className="h-2 w-1/2 rounded bg-current opacity-10" /> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import { connection } from 'next/server' | ||
| import { Wrapper } from '@/components/layout/wrapper' | ||
| import { Link } from '@/components/ui/link' | ||
|
|
||
| export const metadata = { | ||
| title: 'Dynamic route — Instant Navigations demo', | ||
| } | ||
|
|
||
| export default async function ItemPage({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ item: string }> | ||
| }) { | ||
| const { item } = await params | ||
| await connection() | ||
| await new Promise((resolve) => setTimeout(resolve, 1200)) | ||
|
arzafran marked this conversation as resolved.
|
||
|
|
||
| return ( | ||
| <Wrapper theme="dark"> | ||
| <section className="dr-layout-grid min-h-screen content-center py-24 font-mono"> | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| <div className="col-span-full dt:col-start-2 dt:col-end-11 flex flex-col gap-6"> | ||
| <h1 className="text-2xl uppercase">Dynamic route: {item}</h1> | ||
| <p className="max-w-prose opacity-70"> | ||
| One reusable shell is prefetched for this route and shown on the way | ||
| in (see the skeleton). It is identical for every param value — | ||
| <code> alpha</code>, <code>bravo</code>, and <code>charlie</code>. | ||
|
arzafran marked this conversation as resolved.
Outdated
|
||
| </p> | ||
| <Link | ||
| className="underline underline-offset-4" | ||
| href="/instant-nav-demo" | ||
| > | ||
| ← Back to demo hub | ||
| </Link> | ||
| </div> | ||
| </section> | ||
| </Wrapper> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { Wrapper } from '@/components/layout/wrapper' | ||
| import { Link } from '@/components/ui/link' | ||
|
|
||
| export const metadata = { | ||
| title: 'Fast route — Instant Navigations demo', | ||
| } | ||
|
|
||
| export default function FastPage() { | ||
| return ( | ||
| <Wrapper theme="dark"> | ||
| <section className="dr-layout-grid min-h-screen content-center py-24 font-mono"> | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| <div className="col-span-full dt:col-start-2 dt:col-end-11 flex flex-col gap-6"> | ||
| <h1 className="text-2xl uppercase">Fast route</h1> | ||
| <p className="max-w-prose opacity-70"> | ||
| Fully static — no async data. The prefetched shell IS the page, so | ||
| navigation here is immediate with nothing to stream. | ||
| </p> | ||
| <Link | ||
| className="underline underline-offset-4" | ||
| href="/instant-nav-demo" | ||
| > | ||
| ← Back to demo hub | ||
| </Link> | ||
| </div> | ||
| </section> | ||
| </Wrapper> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| import { Wrapper } from '@/components/layout/wrapper' | ||
| import { Link } from '@/components/ui/link' | ||
|
|
||
| export const metadata = { | ||
| title: 'Instant Navigations demo', | ||
| } | ||
|
|
||
| const ITEMS = ['alpha', 'bravo', 'charlie'] | ||
|
|
||
| export default function InstantNavDemoPage() { | ||
| return ( | ||
| <Wrapper theme="dark"> | ||
| <section className="dr-layout-grid min-h-screen content-center py-24 font-mono"> | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| <div className="col-span-full dt:col-start-2 dt:col-end-11 flex flex-col gap-6"> | ||
| <h1 className="text-2xl uppercase">Instant Navigations demo</h1> | ||
| <p className="max-w-prose opacity-70"> | ||
| Throwaway routes for exercising Next.js 16.3 shell-based | ||
| prefetching. Hover a link to prefetch its shell, then click to see | ||
| the shell paint instantly while data streams in. | ||
| </p> | ||
|
|
||
| <nav className="flex flex-col gap-3"> | ||
| <Link | ||
| className="underline underline-offset-4" | ||
| href="/instant-nav-demo/fast" | ||
| > | ||
| → Fast route (synchronous, paints immediately) | ||
| </Link> | ||
| <Link | ||
| className="underline underline-offset-4" | ||
| href="/instant-nav-demo/slow" | ||
| > | ||
| → Slow route (shell first, panel streams in) | ||
| </Link> | ||
| {ITEMS.map((item) => ( | ||
| <Link | ||
| key={item} | ||
| className="underline underline-offset-4" | ||
| href={`/instant-nav-demo/${item}`} | ||
| > | ||
| → Dynamic route: {item} (one shell, reused per param) | ||
| </Link> | ||
| ))} | ||
| </nav> | ||
|
|
||
| <Link className="underline underline-offset-4 opacity-60" href="/"> | ||
| ← Home | ||
| </Link> | ||
| </div> | ||
| </section> | ||
| </Wrapper> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| import { connection } from 'next/server' | ||
| import { Suspense } from 'react' | ||
| import { Wrapper } from '@/components/layout/wrapper' | ||
| import { Link } from '@/components/ui/link' | ||
|
|
||
| export const metadata = { | ||
| title: 'Slow route — Instant Navigations demo', | ||
| } | ||
|
|
||
| // connection() marks this subtree runtime-dynamic; the artificial delay makes | ||
| // the stream visible. Lives inside <Suspense> so the page shell paints | ||
| // immediately and only this panel streams in (partial prerendering under | ||
| // cacheComponents). | ||
| async function StreamedPanel() { | ||
| await connection() | ||
| await new Promise((resolve) => setTimeout(resolve, 1500)) | ||
| return ( | ||
| <p className="max-w-prose opacity-90"> | ||
| Streamed in after ~1.5s. The heading and back-link above were already on | ||
| screen — only this panel waited on the server. | ||
| </p> | ||
| ) | ||
| } | ||
|
|
||
| function PanelSkeleton() { | ||
| return ( | ||
| <div aria-hidden className="w-40 animate-pulse space-y-2"> | ||
| <div className="h-2 rounded bg-current opacity-20" /> | ||
| <div className="h-2 w-3/4 rounded bg-current opacity-20" /> | ||
| <div className="h-2 w-1/2 rounded bg-current opacity-10" /> | ||
| </div> | ||
| ) | ||
| } | ||
|
arzafran marked this conversation as resolved.
|
||
|
|
||
| export default function SlowPage() { | ||
| return ( | ||
| <Wrapper theme="dark"> | ||
| <section className="dr-layout-grid min-h-screen content-center py-24 font-mono"> | ||
|
Copilot marked this conversation as resolved.
Outdated
|
||
| <div className="col-span-full dt:col-start-2 dt:col-end-11 flex flex-col gap-6"> | ||
| <h1 className="text-2xl uppercase">Slow route</h1> | ||
| <p className="max-w-prose opacity-70"> | ||
| The shell (this heading and the link below) paints instantly. The | ||
| panel streams in once the server resolves. | ||
| </p> | ||
| <Suspense fallback={<PanelSkeleton />}> | ||
| <StreamedPanel /> | ||
| </Suspense> | ||
| <Link | ||
| className="underline underline-offset-4" | ||
| href="/instant-nav-demo" | ||
| > | ||
| ← Back to demo hub | ||
| </Link> | ||
| </div> | ||
| </section> | ||
| </Wrapper> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.