Next.js Discord

Discord Forum

Opting into cache components at the route or file level

Unanswered
Giant panda posted this in #help-forum
Open in Discord
Giant pandaOP
Currently if you set Next config with cacheComponents: true, all routes/pages/components must now follow cache components rules, meaning a lot of build errors to be sorted. e.g. errors that runtime data is used without a Suspense wrapper. After reading docs I was under the impression that unless you added the use cache directive, everything would be dynamic by default, but the new restrictions apply globally.

Ideally we'd like to do a gradual adoption– is there any way to only have the new rules apply to explicitly marked files/routes?

1 Reply

Giant pandaOP
Gotcha, thanks for confirmation. It's a massive change hey– quite an undertaking to turn it on for large codebases.