-
Notifications
You must be signed in to change notification settings - Fork 36
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
Prefetching Data within RSCs #29
Comments
It's on the list, but right now we had a lot of stuff on our hands, getting the Apollo Client 3.8 beta out of the door, and I'll be on conferences for the next week. That said, I am not sure if this is the right tool for your (it rarely is for most use cases). Can you explain a little more about "page level prefetching" vs "layout level prefetching" that you mean here? Conceptually, there should not be a lot of difference between those - and generally, there is no inherent need to do that kind of prefetching in RSC at all. You could always just make your page (or layout) a Client Component and use |
So in general prefetching in the way that I described it is really only useful when it comes to helping migrate from the Next One other piece to call-out those is that the new Next.js Metadata API doesn't really work with this flow since your data fetching is done outside of RSC's; any thoughts on this? Basically if we'd like to support metadata from gql calls we'd need to make the call twice (once via I was able to get everything except metadata working with |
@phryneas any thoughts on the above? |
Yeah, sorry for the late reply, I'm just settling in after getting back :)
Gotcha. I'm not sure if we can do a lot for layout <-> page though - that's pretty much a nextjs design decision.
I have to be honest, I haven't worked with that yet, but I've given it a try just now. From what I see, having a
Yup, we are on that :) |
So you can definitely get deduplicated queries for However if you're using |
That can hardly be prevented - Nextjs runs the RSC run and the SSR run in two completely different processes that cannot communicate with each other. It might be possible to use the Nextjs request cache for this (I do not know how they have set that up), but I do not have very high hopes. |
Yea I definitely agree that the two weren't built to work together in general. Was mainly just looking to call out that utilizing With that being said I'm looking forward 3.8 Beta and RSC based prefetching to bridge that gap 😄 |
To be honest, I wouldn't be overly concerned though - not every single request to your GraphQL server is a bad thing, and if those requests happen on your app server, they are probably a lot closer to your "source of truth" and much faster than if a client would make them. |
Hey, I've been taking a peek at how Apollo should be working with Next 13's app directory and found this comment: #9 (comment) chatting a bit more around prefetching within server components and pushing that to client components. In the spirit of allowing for easier migration paths from the pages directory -> app directory we'd really like to use prefetching initially both at the layout level and page level so that we can more easily shift things over.
Has there been any movement around supporting page level prefetching and population to client components? It seems like layout level I should be able to forward the data over as props to the client component and then initialize my cache with it.
Thanks for all the awesome work supporting Next 13!
The text was updated successfully, but these errors were encountered: