Cache components and generateStaticParams won't cache other params #82838
Unanswered
cornedor
asked this question in
App Router
Replies: 0 comments
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.
-
We're trying to build a project with cacheComponents enabled. It is a webshop with many products. Like in any webshop, products come and products go on a regular basis. We'd like to cache product pages, and also let them be accessible when JavaScript is disabled. But this seems to be impossible with cacheComponents enabled.
I've created a reproduction repo: https://github.com/cornedor/cache-components-route/blob/main/src/app/%5Bslug%5D/page.tsx and deployed to Vercel.
You can see the "baz" page being rendered correctly and cached: https://cache-components-route.vercel.app/baz
This is one of the slugs that is included in the generateStaticParams.
When opening another page that is not included, for example https://cache-components-route.vercel.app/new, you'll see the loader for 1 second before the page is shown. This happens every time you open the page.
We also tried not using generateStaticParams.
Components are cached much better this way, and the page always seems to be available instantly after a refresh. However, when disabling JavaScript, you always get the loader.
Is this a known limitation of cacheComponents? Are there any recommended
patterns for dynamic e-commerce sites that need both caching and no-JS support?
Next.js version: 15.4.2-canary.56 (node 22.17.0)
Beta Was this translation helpful? Give feedback.
All reactions