first commit
Some checks failed
Test examples / Test Examples (20) (push) Has been cancelled
Test examples / Test Examples (22) (push) Has been cancelled
Lock Threads / action (push) Has been cancelled
Trigger Release / start (push) Has been cancelled
Stale issue handler / stale (push) Has been cancelled
Update Font Data / create-pull-request (push) Has been cancelled
build-and-deploy / deploy-target (push) Has been cancelled
build-and-deploy / build (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-musl - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-unknown-linux-gnu - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-pc-windows-msvc - node@16 (push) Has been cancelled
build-and-deploy / stable - aarch64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / stable - x86_64-apple-darwin - node@16 (push) Has been cancelled
build-and-deploy / build-wasm (nodejs) (push) Has been cancelled
build-and-deploy / build-wasm (web) (push) Has been cancelled
build-and-deploy / Deploy preview tarball (push) Has been cancelled
build-and-deploy / Potentially publish release (push) Has been cancelled
build-and-deploy / publish-turbopack-npm-packages (push) Has been cancelled
build-and-deploy / Deploy examples (push) Has been cancelled
build-and-deploy / thank you, build (push) Has been cancelled
build-and-deploy / Upload Turbopack Bytesize metrics to Datadog (push) Has been cancelled
Rspack Next.js development integration tests / Rspack integration tests (push) Has been cancelled
Rspack Next.js production integration tests / Rspack integration tests (push) Has been cancelled
Turbopack Next.js development integration tests / Next.js integration tests (push) Has been cancelled
Turbopack Next.js production integration tests / Next.js integration tests (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack development test manifest (push) Has been cancelled
Update Rspack test manifest / Update and upload Rspack production test manifest (push) Has been cancelled
Upload bundler test manifests to areweturboyet.com / Upload test results (push) Has been cancelled
Update React / create-pull-request (push) Has been cancelled
test-e2e-project-reset-cron / reset-test-project (push) Has been cancelled
Notify about the top 15 issues/PRs/feature requests (most reacted) in the last 90 days / run (push) Has been cancelled

This commit is contained in:
Arian Tron
2026-03-10 19:37:31 +03:30
commit 61f56f997c
27684 changed files with 2784175 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
import { lang } from 'next/root-params'
import { cookies } from 'next/headers'
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
export default async function Page() {
return (
<main>
<DebugRenderKind />
<p>
This page uses root params and some uncached IO. Root params should
always be available in static prerenders, so a runtime prefetch should
have them too.
</p>
<Suspense fallback="Loading 1...">
<RuntimePrefetchable />
</Suspense>
</main>
)
}
async function RuntimePrefetchable() {
await cookies()
const currentLang = await lang()
await cachedDelay([__filename, currentLang])
return (
<div style={{ border: '1px solid blue', padding: '1em' }}>
<div id="root-param-value">{`Lang: ${currentLang}`}</div>
<Suspense fallback={<div style={{ color: 'grey' }}>Loading 2...</div>}>
<Dynamic />
</Suspense>
</div>
)
}
async function Dynamic() {
await uncachedIO()
await connection()
return (
<div style={{ border: '1px solid tomato', padding: '1em' }}>
<div id="dynamic-content">Dynamic content</div>
</div>
)
}

View File

@@ -0,0 +1,55 @@
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
import { lang } from 'next/root-params'
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
export default async function Page() {
return (
<main>
<DebugRenderKind />
<p>
This page uses root params (inside a private cache) and some uncached
IO. Private caches are only rendered during runtime prefetches and
navigation requests, so they won't be part of a static prefetch, but
they should be part of a runtime prefetch.
</p>
<Suspense fallback="Loading 1...">
<RuntimePrefetchable />
</Suspense>
</main>
)
}
async function RuntimePrefetchable() {
const currentLang = await privateCache()
return (
<div style={{ border: '1px solid blue', padding: '1em' }}>
<div id="root-param-value">{`Lang: ${currentLang}`}</div>
<Suspense fallback={<div style={{ color: 'grey' }}>Loading 2...</div>}>
<Dynamic />
</Suspense>
</div>
)
}
async function privateCache() {
'use cache: private'
const currentLang = await lang()
await cachedDelay([__filename, currentLang])
return currentLang
}
async function Dynamic() {
await uncachedIO()
await connection()
return (
<div style={{ border: '1px solid tomato', padding: '1em' }}>
<div id="dynamic-content">Dynamic content</div>
</div>
)
}

View File

@@ -0,0 +1,34 @@
import Link from 'next/link'
import { lang } from 'next/root-params'
import { ReactNode } from 'react'
export default async function RootLayout({
children,
}: {
children: ReactNode
}) {
const currentLang = await lang()
return (
<html lang={currentLang}>
<body style={{ fontFamily: 'monospace' }}>
<Header />
{children}
</body>
</html>
)
}
async function Header() {
const currentLang = await lang()
return (
<header>
<Link href={`/with-root-param/${currentLang}`} prefetch={false}>
Home (for lang: {currentLang})
</Link>
</header>
)
}
export function generateStaticParams() {
return [{ lang: 'en' }]
}

View File

@@ -0,0 +1,73 @@
import { lang } from 'next/root-params'
import { DebugLinkAccordion } from '../../../components/link-accordion'
export default async function Page() {
const currentLang = await lang()
const otherLang = currentLang === 'en' ? 'de' : 'en'
return (
<main>
<h1>Home - with root param ({currentLang})</h1>
<h2>directly in a page</h2>
<ul>
<li>
root params + dynamic content
<ul>
<li>
<DebugLinkAccordion
href={`/with-root-param/${currentLang}/in-page/root-params`}
/>
</li>
<li>
<DebugLinkAccordion
href={`/with-root-param/${otherLang}/in-page/root-params`}
/>
</li>
</ul>
</li>
</ul>
<h2>
<code>use cache: private</code>
</h2>
<ul>
<li>
root params + dynamic content
<ul>
<li>
<DebugLinkAccordion
href={`/with-root-param/${currentLang}/in-private-cache/root-params`}
/>
</li>
<li>
<DebugLinkAccordion
href={`/with-root-param/${otherLang}/in-private-cache/root-params`}
/>
</li>
</ul>
</li>
</ul>
<h2>
<code>promise passed to public cache</code>
</h2>
<ul>
<li>
root params + dynamic content
<ul>
<li>
<DebugLinkAccordion
href={`/with-root-param/${currentLang}/passed-to-public-cache/root-params`}
/>
</li>
<li>
<DebugLinkAccordion
href={`/with-root-param/${otherLang}/passed-to-public-cache/root-params`}
/>
</li>
</ul>
</li>
</ul>
</main>
)
}

View File

@@ -0,0 +1,55 @@
import { Suspense } from 'react'
import { cachedDelay, DebugRenderKind, uncachedIO } from '../../../../shared'
import { connection } from 'next/server'
import { lang } from 'next/root-params'
export const unstable_instant = {
prefetch: 'runtime',
samples: [{ params: { lang: 'en' } }],
}
export default async function Page() {
return (
<main>
<DebugRenderKind />
<p>
This page uses root params (passed to a private cache) and some uncached
IO. Root params should always be available in static prerenders, so a
runtime prefetch should have them too, and they should not be considered
a hanging input.
</p>
<Suspense fallback="Loading 1...">
<RuntimePrefetchable />
</Suspense>
</main>
)
}
async function RuntimePrefetchable() {
const currentLang = await publicCache(lang())
return (
<div style={{ border: '1px solid blue', padding: '1em' }}>
<div id="root-param-value">{`Lang: ${currentLang}`}</div>
<Suspense fallback={<div style={{ color: 'grey' }}>Loading 2...</div>}>
<Dynamic />
</Suspense>
</div>
)
}
async function publicCache(currentLangPromise: Promise<string>) {
'use cache'
const currentLang = await currentLangPromise
await cachedDelay([__filename, currentLang])
return currentLang
}
async function Dynamic() {
await uncachedIO()
await connection()
return (
<div style={{ border: '1px solid tomato', padding: '1em' }}>
<div id="dynamic-content">Dynamic content</div>
</div>
)
}