next.js
039c56f7 - docs: clarify that `use cache` requires async functions (#92101)

Commit
55 days ago
docs: clarify that `use cache` requires async functions (#92101) ### What? Update the "Good to know" note in the `use cache` directive docs to clarify that functions and components using `use cache` must be `async` at all levels — not just at file level. ### Why? Users get the build error `"use cache" functions must be async functions` when applying the directive to a synchronous component. The existing note only mentions the file-level case ("When used at file level, all function exports must be async functions"), which implies the async requirement doesn't apply at component or function level. ### How? Updated the "Good to know" callout to state the requirement applies to all functions and components using `use cache`, with the file-level case as additional context. ## PR checklist (Improving Documentation) - Run `pnpm prettier-fix` to fix formatting issues before opening the PR - Follow the docs contribution guide: https://nextjs.org/docs/community/contribution-guide --------- Co-authored-by: Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
Author
Parents
Loading