mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
We're splitting the test app routes between two root layouts, one for (partially) static pages that does not wrap its children in a Suspense boundary, and one for dynamic pages that adds a Suspense boundary above `body`, which opts those pages into fully dynamic rendering. Two tests are expected to fail for now, because they revealed bugs related to revalidation, which will be fixed in follow-up PRs: - https://github.com/vercel/next.js/pull/81611 - https://github.com/vercel/next.js/pull/81621 closes NAR-171
26 lines
542 B
TypeScript
26 lines
542 B
TypeScript
import { cookies } from 'next/headers'
|
|
import React from 'react'
|
|
|
|
async function getData() {
|
|
'use cache'
|
|
|
|
return fetch('https://next-data-api-endpoint.vercel.app/api/random', {
|
|
headers: {
|
|
Authorization: `Bearer ${process.env.MY_TOKEN}`,
|
|
},
|
|
}).then((res) => res.text())
|
|
}
|
|
|
|
export default async function Page() {
|
|
const myCookies = await cookies()
|
|
const id = myCookies.get('id')?.value
|
|
|
|
return (
|
|
<>
|
|
<p>index page</p>
|
|
<p id="random">{await getData()}</p>
|
|
<p id="my-id">{id || ''}</p>
|
|
</>
|
|
)
|
|
}
|