Feature Request: make data
in +page.ts
a function that lazily load data from the server
#13034
Labels
Milestone
data
in +page.ts
a function that lazily load data from the server
#13034
Describe the problem
Today the
data
argument we get in the universal load function is eagerly evaluatedkit/packages/kit/src/runtime/client/client.js
Line 2450 in 94c45b9
this is mostly fine but it would be cool if instead we could lazily load the server data in the universal load function in case we don't need it.
What this would allow is having the ability to cache something client side and have the server load function be invoked only if we don't have client data...something like this eg.
this would basically prevent a trip to the server for data that we might know it's already in the client.
Describe the proposed solution
Turn
data
in a function so that the user can call that lazily. Obviously in case we don't have an universal load function we should just call it ourselves to pass data to the component.Alternatives considered
No response
Importance
nice to have
Additional Information
No response
The text was updated successfully, but these errors were encountered: