next.js
a2cc0734 - Model prerender store as separate server and client scopes (#79429)

Commit
243 days ago
Model prerender store as separate server and client scopes (#79429) When we adopted the architecture of WorkUnitStore the idea was that code could be running in only one scope at a time. The point was to limit accidental leakage of incorrect data into a scope, for instance by carrying request data into a cache function where it would poison the cache entry that reads from it. However the model of these stores did not discriminate between rendering for RSC and rendering for the client. There are many APIs that are only available in RSC and that should not work when performing an HTML render on the server but without discriminating between the render type it is impossible to make such differentiations at runtime and we must rely on other means to prevent incorrect usage of APIs in the wrong scope. This change forks the prerender store (dynamicIO) into a server ('prerender') and client ('prerender-client') type. At the moment they still share all the same store properties but in later updates I will be removing all the unnecessary properties from the client version of this store.
Author
Parents
Loading