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
I am clear about data fetching in Server Components and Client Components. But I want to know is there any way to fetch data in Server components and will be cached for all its nested client components. It is my first questions-
I see, using useQuery hook from @urql/next in client component, without wrapping Suspense boundary almost behave as ssr data fetch. I don't get any flashed. But in my previous project I see that, in production, some page which has multiple useQuery in a client component, causing continuous data fetch and hanging the websites. After some research and reading docs carefully I see I need to wrap with Suspense. After wrapping with Suspense continuous data fetching and page hang was solved but, but there is a loading screen.
Without wrapping Suspense using useQuery do not suspend query after getting initial response.
I try to find if there is any useSuspenseQuery, I do not find it.
If anyone know the mechanism about this, please explain?
Again, if there is any way to fetch data on Server component and cached to it all nested client components. Because I don't want to show a loading screen in my page, using Suspense we need to do that. Tanstack query already has the options for caching data to client component from server component.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
From this docs-
https://commerce.nearform.com/open-source/urql/docs/advanced/server-side-rendering/#nextjs
I am clear about data fetching in Server Components and Client Components. But I want to know is there any way to fetch data in Server components and will be cached for all its nested client components. It is my first questions-
I see, using
useQuery
hook from@urql/next
in client component, without wrappingSuspense
boundary almost behave as ssr data fetch. I don't get any flashed. But in my previous project I see that, in production, some page which has multipleuseQuery
in a client component, causing continuous data fetch and hanging the websites. After some research and reading docs carefully I see I need to wrap withSuspense
. After wrapping withSuspense
continuous data fetching and page hang was solved but, but there is a loading screen.Without wrapping
Suspense
usinguseQuery
do not suspend query after getting initial response.I try to find if there is any
useSuspenseQuery
, I do not find it.If anyone know the mechanism about this, please explain?
Again, if there is any way to fetch data on Server component and cached to it all nested client components. Because I don't want to show a loading screen in my page, using
Suspense
we need to do that. Tanstack query already has the options for caching data to client component from server component.If need to review my code-
Here is my whole code-
https://github.com/siamahnaf/nextjs-middleware-warning
Beta Was this translation helpful? Give feedback.
All reactions