[✨] Nextjs style cache revalidation for server fetched data #130
engineersamwell
started this conversation in
Proposals For Qwik
Replies: 1 comment
-
We moved this issue to |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem?
Currently when fetching data in a
routeLoader$
i've noticed stale data with back buttoning after changing an item. Let's say I'm fetching products in arouteLoader$
to be displayed on a products page, then I click a product that takes me to product 1 with name 'a' which I change the name to 'b' then I back button to the products page. The list will still show product 1 with 'a' instead of the correct value 'b'. If I forward and back again it will show the change.cacheControl
. I can fix this issue if I usecacheControl
to disable the cache completely, but imo that's not optimal. I should be able to aggressively cache content while having the manual control to revalidate that content only when I know it's changed.Describe the solution you'd like
Nextjs solves this issue with cache revalidation in a few ways, see: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#revalidating-data
You can either revalidate a path:
Or revalidate a collection associated with a fetch:
The
revalidateTag
is very precise and a solution I would love to see with Qwik.Describe alternatives you've considered
maxAge
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions