Files
Wyatt JohnsonandGitHub 55950d37e4 refactor: added more strict app segment config parsing (#70479)
This enhances the current parsing completed by Next.js of configuration
from app segments. Previously a collection of fragile checks was used to
parse the different segment configuration options which performed no
validation on the inputs.

This uses the `zod` library (which we already use internally) to perform
validation on the configuration exported. A followup PR #70480 will add
more verbose error logging around the validation errors.
2024-09-30 21:02:12 -07:00

22 lines
495 B
JavaScript

import { cache, use } from 'react'
export const runtime = 'edge'
export default function Page() {
const getData = cache(() =>
fetch('https://next-data-api-endpoint.vercel.app/api/random?page', {
cache: 'no-store',
}).then((res) => res.text())
)
const dataPromise = getData()
const data = use(dataPromise)
return (
<>
<p id="page">/variable-revalidate/no-cache</p>
<p id="page-data">no-store: {data}</p>
<p id="now">{Date.now()}</p>
</>
)
}