Replies: 2 comments 1 reply
-
This problem still occurs even when the import { Suspense } from 'react';
import ClientComponent from './_component/ClientComponent';
export const Page = () => {
return (
<Suspense fallback={<div>Loading...</div>}>
<ClientComponent />
</Suspense>
);
};
export default Page; |
Beta Was this translation helpful? Give feedback.
0 replies
-
yes, because client components also render on the server during SSR, and Everything you said is expected. Please read the docs on SSR, especially the advanced ssr guide around streaming. You have to get data into the client cache somehow, and we offer multiple ways to do so. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I'm using Next.js with the App Router, and I’ve been wondering how
useSuspenseQuery
operates during server-side rendering (SSR).Here’s my question
How exactly does
useSuspenseQuery
behave during Server-Side Rendering (SSR)?My setup
In this case, I expected that the
useSuspenseQuery
hook in the ClientComponent would not be executed during the SSR phase.However, when checking the server logs in the Next.js environment, I saw logs data fetching called.
This made it appear as if
useSuspenseQuery
was actually executed on the server. Furthermore, after the page loaded in the browser, the same API was called again, and since the randomData returned was different, a hydration mismatch occurred.To be more specific, when observing the behavior visually, the HTML returned from the server includes empty data, but the content shown on the screen contains the randomData that was fetched on the server. After that, the client triggers the API call again, and since the returned data differs, a hydration mismatch occurs.
https://github.com/user-attachments/assets/b34a722c-2e27-4a0b-a578-133c19fd6a4a
Does
useSuspenseQuery
perform an API call during SSR? I'm curious about how it actually works under the hood.(I confirmed that switching to
useQuery
does not behave the same way.)Beta Was this translation helpful? Give feedback.
All reactions