Repository navigation
Static page with use cache still shows a Suspense fallback on Vercel #99863
Replies: 2 comments 2 replies
|
I think the important distinction here is between the cached data and the rendering boundary created by
However, So I wouldn't interpret the behavior as:
I'd interpret it more as:
In your example, the fact that If the books are genuinely part of the static shell and you don't need a loading state for them, I would simply remove the export default function Page() {
return (
<main>
<h1>Books</h1>
<LatestBooks />
</main>
)
}That matches the Cache Components model: use One thing I'd also verify in a minimal reproduction is whether you're testing with a hard refresh versus client-side navigation. Those exercise different cache/rendering paths, so reproducing the flash consistently in both cases would help determine whether this is expected Suspense behavior or an actual Next.js/Vercel rendering issue. |
|
I tried a minimal production reproduction of your two routes on Next.js 16.2.10 / React 19.2.1, with <main><h1>With Suspense</h1><!--$--><ul><li>BUILD_TIME_BOOK_SENTINEL</li></ul><!--/$--></main>I also checked three document requests per route through So I would not conclude that wrapping already-prerendered content in Suspense necessarily makes it stream separately on every hard refresh. For your three follow-up questions:
To distinguish a rendering issue from cache/revalidation behavior, I would compare:
A cached function's runtime cache and the prerendered route output are different things; serverless runtime cache persistence alone does not prove the route should display a fallback. See Next.js caching/prerendering, Could you share the exact Next.js version and a minimal reproduction/deployment? Your snippet alone did not produce the flash in the setup above, so removing Suspense may hide the symptom without explaining the deployment difference. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
I have two static pages, both deployed to Vercel. Both load the same books from a function marked with
"use cache"andcacheLife("max"). Neither page reads cookies, headers, or search params. Both are prerendered.On Vercel, a refresh of
/with-suspensesometimes shows "Loading books...", then the books. A refresh of/without-suspenseshows the books immediately, with no flash.Why does the Suspense fallback show on a static page when the data is already cached? Should cached content on a static page be rendered without
<Suspense>?I am struggling to understand the difference and proper usage.
Additional information
No response
Example
No response
All reactions