mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
This attempts to fix an issue where fetch requests were not being deduped on the first request to the page (but subsequent requests were properly deduped). This seems to be caused by the async context from `staticGenerationStore` being lost by the time the patched fetch is called, and so it was falling back to a regular fetch and skipping the cache. This attempts to fix that by falling back to `fetch.__nextGetStaticStore()`. [slack x-ref](https://vercel.slack.com/archives/C03KAR5DCKC/p1691007445597619)
33 lines
490 B
JavaScript
33 lines
490 B
JavaScript
export async function generateStaticParams() {
|
|
return [
|
|
{
|
|
slug: 'slug-0',
|
|
},
|
|
{
|
|
slug: 'slug-1',
|
|
},
|
|
{
|
|
slug: 'slug-2',
|
|
},
|
|
{
|
|
slug: 'slug-3',
|
|
},
|
|
{
|
|
slug: 'slug-4',
|
|
},
|
|
]
|
|
}
|
|
|
|
export default async function Page({ params }) {
|
|
const data = await fetch(
|
|
`http://localhost:${process.env.TEST_SERVER_PORT}`
|
|
).then((res) => res.text())
|
|
|
|
return (
|
|
<>
|
|
<p>hello world</p>
|
|
<p id="data">{data}</p>
|
|
</>
|
|
)
|
|
}
|