forked from vercel/next.js
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move fetch revalidate config under next options (vercel#41505)
x-ref: [slack-thread](https://vercel.slack.com/archives/C035J346QQL/p1665425741387879)
- Loading branch information
Showing
7 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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 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 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
File renamed without changes.
This file contains 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
3 changes: 3 additions & 0 deletions
3
test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/loading.js
This file contains 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,3 @@ | ||
export default function Page() { | ||
return <p>loading...</p> | ||
} |
25 changes: 25 additions & 0 deletions
25
test/e2e/app-dir/app-static/app/ssr-auto/fetch-revalidate-zero/page.js
This file contains 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,25 @@ | ||
import { cache, use } from '../../../lib/utils' | ||
|
||
export default function Page() { | ||
const getData = () => | ||
fetch('https://example.vercel.sh', { | ||
next: { revalidate: 0 }, | ||
}) | ||
.then((res) => res.text()) | ||
.then((text) => new Promise((res) => setTimeout(() => res(text), 1000))) | ||
const dataPromise = cache(getData) | ||
const data = use(dataPromise) | ||
|
||
return ( | ||
<> | ||
<p id="page">/ssr-auto/fetch-revalidate-zero</p> | ||
<div id="example-dat">{data}</div> | ||
<p id="date">{Date.now()}</p> | ||
</> | ||
) | ||
} | ||
|
||
// TODO-APP: remove revalidate config once next.revalidate is supported | ||
export const config = { | ||
revalidate: 0, | ||
} |