You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the recommended PreloadQuery + useSuspenseQuery pattern for Next.js App Router, the Suspense fallback always appears in the initial server-rendered HTML, causing a visible flash during page load.
"During initial render, the fallback should NOT appear because data preloading completes server-side before hydration."
And:
"The Suspense boundary here is optional and only for demonstration purposes."
However, in practice, the fallback is consistently rendered in the SSR HTML.
Expected Behavior:
The Suspense fallback should not appear in the initial HTML response. The preloaded data should be available immediately during hydration, preventing the Suspense boundary from activating.
Props-based approach works - Using direct await getClient().query() in RSC and passing data as props eliminates the flash completely, but this bypasses the PreloadQuery pattern entirely.
Environment:
@apollo/client:4.0.9@apollo/client-integration-nextjs:0.14.1next:16.0.1react:19.2.0Description:
When using the recommended
PreloadQuery+useSuspenseQuerypattern for Next.js App Router, the Suspense fallback always appears in the initial server-rendered HTML, causing a visible flash during page load.According to the official documentation:
And:
However, in practice, the fallback is consistently rendered in the SSR HTML.
Expected Behavior:
The Suspense fallback should not appear in the initial HTML response. The preloaded data should be available immediately during hydration, preventing the Suspense boundary from activating.
Actual Behavior:
The Suspense fallback appears in the SSR HTML:
This causes a visible flash as the page loads, then hydrates with the actual data.
Code Example
Server Component (
app/page.tsx):Client Component (
components/products-list.tsx):Apollo Client Setup (
lib/apollo-client.ts):Client Wrapper (
lib/apollo-wrapper.tsx):Attempted Workarounds
Importing the streaming module - Adding
import "@apollo/client-react-streaming";to preload the module (as suggested in SimulatePreloadedQuery suspends on mount because it's lazy loaded #506) did not resolve the issue.Props-based approach works - Using direct
await getClient().query()in RSC and passing data as props eliminates the flash completely, but this bypasses the PreloadQuery pattern entirely.