Minimal RSC refresh
Unanswered
Asiatic Lion posted this in #help-forum
Asiatic LionOP
I'm really fascinated with the possibility of using RSC as the format for fetching updates on the client.
Using old-style api json request, I am able to update a single client component specifically at a time.
For server component updates I'm only aware of using
What's the current/planned pattern for fetching the smallest RSC update for a limited server component tree.
Is the currently a way to fetch the RSC data for a single page/route segment (without fetching layouts/pages above or below on the path)?
Using old-style api json request, I am able to update a single client component specifically at a time.
For server component updates I'm only aware of using
revalidatePath with server actions to get the RSC output of basically all server components on this path or router.refresh to get the same result with GET request.What's the current/planned pattern for fetching the smallest RSC update for a limited server component tree.
Is the currently a way to fetch the RSC data for a single page/route segment (without fetching layouts/pages above or below on the path)?
6 Replies
@joulev yes there is and it's `revalidateTag`
Asiatic LionOP
Interesting! Thank you for the response.
Can I take this to mean that if I revalidate a particular tag in a server action, I will only get the updated RSC for the server components that depends on data from the given tag?
Do you know of any documentation about this feature?
Can I take this to mean that if I revalidate a particular tag in a server action, I will only get the updated RSC for the server components that depends on data from the given tag?
Do you know of any documentation about this feature?
Asiatic LionOP
Thanks @Giant panda
I've seen this documentation. I was looking after some documentation more specifically about revalidating/rendering only a limited set of server components on a given path.
I've seen this documentation. I was looking after some documentation more specifically about revalidating/rendering only a limited set of server components on a given path.
@Asiatic Lion Interesting! Thank you for the response.
Can I take this to mean that if I revalidate a particular tag in a server action, I will _only_ get the updated RSC for the server components that depends on data from the given tag?
Do you know of any documentation about this feature?
See also https://nextjs-forum.com/post/1216996751718879343#message-1217000530715480084
I don’t know what qualifies to you as “only get the updated rsc for the server components that depends on data from the given tagâ€, but nextjs determines what has changed to recalculated it to send in the server action response payload. When a tag is revalidated, it is changed, when a tag is not revalidated, it is not changed
I don’t know what qualifies to you as “only get the updated rsc for the server components that depends on data from the given tagâ€, but nextjs determines what has changed to recalculated it to send in the server action response payload. When a tag is revalidated, it is changed, when a tag is not revalidated, it is not changed
@joulev See also https://discord.com/channels/752553802359505017/1216996751718879343/1217000530715480084
I don’t know what qualifies to you as “*only* get the updated rsc for the server components that depends on data from the given tagâ€, but nextjs determines what has changed to recalculated it to send in the server action response payload. When a tag is revalidated, it is changed, when a tag is not revalidated, it is not changed
Asiatic LionOP
Thank you for the response!
Can you elaborate on how "nextjs determines what has changed"
As far as I can tell, I just get the entire page as a response payload for revalidateTag
Can you elaborate on how "nextjs determines what has changed"
As far as I can tell, I just get the entire page as a response payload for revalidateTag