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
Let's considerer a page having a server load function defined.
When prerendering the server load function, a json file is created at build time, containing the serialized data returned by the load function. Which is great.
Now at runtime, everytime the user accesses the given page (by hovering and/or clicking on the link to the corresponding route), a HTTP request is triggered to retrieve the json data from the server load function, before the page can be rendered on screen.
That's the thing here: even if those HTTP requests gets a 304 Not Modified response after the initial call, it's still a HTTP request that potentially introduces some latency before the component is rendered on screen. And that is happening every single time the route is accessed. It's indeed some useless HTTP calls that we could get rid of, in some circumstances where we know we don't need to re-check the server data every single time we access a route (like when the server load function is prerendered).
Would be interesting then to be able to mark a server load function as immutable or something. This would mean that the server load function data is considered immutable as long as the app version doesn't change for example. Only when the app version changes, that the data would be re-downloaded once, but never checked again when accessing the same route multiple time. That would get rid of those HTTP requests when we know we don't need them.
Something like:
// immutability per app versionexportconstimmutable=true;
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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Let's considerer a page having a server load function defined.
When prerendering the server load function, a json file is created at build time, containing the serialized data returned by the load function. Which is great.
Now at runtime, everytime the user accesses the given page (by hovering and/or clicking on the link to the corresponding route), a HTTP request is triggered to retrieve the json data from the server load function, before the page can be rendered on screen.
That's the thing here: even if those HTTP requests gets a
304 Not Modified
response after the initial call, it's still a HTTP request that potentially introduces some latency before the component is rendered on screen. And that is happening every single time the route is accessed. It's indeed some useless HTTP calls that we could get rid of, in some circumstances where we know we don't need to re-check the server data every single time we access a route (like when the server load function is prerendered).Would be interesting then to be able to mark a server load function as
immutable
or something. This would mean that the server load function data is considered immutable as long as the app version doesn't change for example. Only when the app version changes, that the data would be re-downloaded once, but never checked again when accessing the same route multiple time. That would get rid of those HTTP requests when we know we don't need them.Something like:
Beta Was this translation helpful? Give feedback.
All reactions