-
Notifications
You must be signed in to change notification settings - Fork 27.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not cache fetch calls inside
"use cache"
implicitly
If a `fetch` call inside of `"use cache"` has not specified `cache: 'force-cache'` or `revalidate`, we should not cache it implicitly in the fetch cache. Instead, it's only cached as part of the surrounding cached function. Those `fetch` calls that do specify `cache: 'force-cache'` or `revalidate` are still cached in the fetch cache. They're like an inner `"use cache"`. They also don't inherit the tags of the outer `"use cache"`. partially reverts #71793 and #72075 supersedes #72090
- Loading branch information
1 parent
c0052b8
commit 375e642
Showing
5 changed files
with
181 additions
and
84 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 was deleted.
Oops, something went wrong.
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,63 @@ | ||
import React from 'react' | ||
import { revalidatePath, revalidateTag } from 'next/cache' | ||
|
||
export function RevalidateButtons() { | ||
return ( | ||
<form> | ||
<button | ||
id="revalidate-a" | ||
formAction={async () => { | ||
'use server' | ||
revalidateTag('a') | ||
}} | ||
> | ||
revalidate a | ||
</button>{' '} | ||
<button | ||
id="revalidate-b" | ||
formAction={async () => { | ||
'use server' | ||
revalidateTag('b') | ||
}} | ||
> | ||
revalidate b | ||
</button>{' '} | ||
<button | ||
id="revalidate-c" | ||
formAction={async () => { | ||
'use server' | ||
revalidateTag('c') | ||
}} | ||
> | ||
revalidate c | ||
</button>{' '} | ||
<button | ||
id="revalidate-f" | ||
formAction={async () => { | ||
'use server' | ||
revalidateTag('f') | ||
}} | ||
> | ||
revalidate f | ||
</button>{' '} | ||
<button | ||
id="revalidate-r" | ||
formAction={async () => { | ||
'use server' | ||
revalidateTag('r') | ||
}} | ||
> | ||
revalidate r | ||
</button>{' '} | ||
<button | ||
id="revalidate-path" | ||
formAction={async () => { | ||
'use server' | ||
revalidatePath('/cache-tag') | ||
}} | ||
> | ||
revalidate path | ||
</button> | ||
</form> | ||
) | ||
} |
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