-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
feature / enhancementNew feature or requestNew feature or request
Milestone
Description
Describe the problem
Pages can return a maxage property from load which a) sets a Cache-Control header on the server response, and b) causes the returned value to be cached in memory so that navigating back to the page won't result in a repeated load.
This mostly works, but has limitations:
- determining whether to add
publicis based on a heuristic (nofetchwithoutcredentials: 'omit', and nosessionaccess) that doesn't cover every edge case - there's nowhere to express
revalidate - some people want to be able to express
s-maxagerather thanmaxage, though I'll confess I don't fully understand why
Describe the proposed solution
Replace maxage with a cache object:
<script context="module">
/** @type {import('@sveltejs/kit').Load} */
export async function load() {
return {
props: {...},
cache: {
maxage: 3600,
private: false // if unset, uses existing heuristic
}
};
}
</script>In future, we could add revalidate and smaxage if those prove necessary.
Alternatives considered
No response
Importance
nice to have
Additional Information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature / enhancementNew feature or requestNew feature or request