Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

is the polls demo really server side? #104

Closed
yanv1991 opened this issue Sep 29, 2023 · 3 comments
Closed

is the polls demo really server side? #104

yanv1991 opened this issue Sep 29, 2023 · 3 comments

Comments

@yanv1991
Copy link

This is more like a question rather than reporting an issue, but essentially we are noticing in our app that usequery hook is fetching the data in the client side rather than ssr. I was checking this demo https://github.com/apollographql/apollo-client-nextjs/tree/main/examples/polls-demo and I noticed if you disable js in this url https://apollo-next-13-polls.vercel.app/cc the data is not shown.
Screenshot 2023-09-29 at 5 06 23 PM

My question is should I fetch this data rather using a RSC?? My dilemma is, we are using paginated data so not sure if I should fetch the initial data in RSC and later concatenate the rest on the fly when user scroll down.

Thanks in advance for the help....

@phryneas
Copy link
Member

phryneas commented Oct 2, 2023

That page is not using RSC, but React's "Streaming SSR" in a client component. That means that on first load, everything on that page will be rendered on the server - but the server doesn't wait for everything to be ready to send it to the browser, but it sends it over chunk-by-chunk.
And that means that you need JavaScript enabled to "puzzle together" these server-rendered chunks.
If you look at the network tab, you'll still see that no network requests are made for the client (for the first load) - because those were made on the server and rendered on the server.

So yes, it's server-side. Just a lot more complex version of "SSR" as you knew from the past.

@phryneas
Copy link
Member

I'm doing some housekeeping so I'm closing some older issues that haven't seen activity in a while.
If this is still relevant, please feel free to reopen the issue.

Copy link
Contributor

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo Client usage and allow us to serve you better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants