Docs: How to "use cache" but only at runtime (not build)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.5k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
What is the documentation issue?
I want to "use cache" some DB queries (in memory), but I absolutely don't want them to be pre-rendered during the build (my build environment doesn't even have access to the database). How do I exclude those from prerendering?
I initially thought I could await connection() but it doesn't work inside "use cache".
Is there any context that might help us understand?
Does the docs page already exist? Please link to it.
https://nextjs.org/docs/app/getting-started/cache-components
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the cache components documentation at https://nextjs.org/docs/app/getting-started/cache-components and review its guidance on cached database queries and prerendering. Update the page to explain how to keep "use cache" queries from running during the build, including the relevant runtime-only pattern; the issue is done when this scenario is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100