Should I need to add cache option in "fetch" inside of server action if wanna cache data? #76428
Unanswered
kientrant1
asked this question in
Help
Replies: 1 comment 1 reply
-
Yeah, I guess so, the thing is that a server action is typically, used to do server side mutations, and it is a sensible default, to not cache any fetch requests made within that intention, so that you can mutate the data properly. I'd say, better be explicit anyway. In Next 15, they reworked the defaults during SSR, and I've seen some people tripped by the implicit mechanics, the solution has been, to make fetch caching explicit, where possible. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
As following these points, they're mentioned in document of NextJS 14
Used inside a Server Action.
Used inside a Route Handler that uses the POST method
If so, when I use "fetch" request inside of server action. Then, data will be cached or not. And do I need to add "cache" option in this situation. Can you help to clarify my concerns? Thanks!
Additional information
I'm using Next.js version 14
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions