next.js
1558dbef - [test] Add test cases for dynamic caches without suspense boundaries (#85500)

Commit
88 days ago
[test] Add test cases for dynamic caches without suspense boundaries (#85500) When defining a `cacheLife` with an expire time below 5 minutes or a revalidate time of 0 we consider the `'use cache'` function dynamic during prerendering, i.e. it will be excluded from the static shell. Similarly, accessing runtime `params` (not defined in `generateStaticParams`) also makes the function dynamic. Those cases require adding a parent suspense boundary. If there's no suspense boundary, we should show an error during prerendering at build time, as well as in development as part of the prerender validation. The latter is currently not working as expected when the `'use cache'` directive is used in a page (or layout) directly. As the added snapshot tests show, no redbox is shown in those cases. This is a known issue that we plan to address separately. We will also follow up with improving the error messages and docs for those dynamic cache cases. This detail got lost in #85087.
Author
Parents
Loading