Allow bypassing cache for load and save
daun opened this issue · comments
Philipp Daun commented
Describe the problem
There should be a way of disabling the cache to help with forms, especially on POST requests.
- Bypass cache on load: ignore any previously cached pages
- Skip cache on save: do not store the response in the cache
Describe the proposed solution
- Extend
FetchOptions
with two parameters, e.g.
a.bypassCache
andskipCacheSave
with defaultfalse
b.getFromCache
andsaveToCache
with defaulttrue
- Extend
FetchOptions
with acacheControl
parameter that mimics the Cache-Control header - Directly read from the request headers and interpret the
Cache-Control
header ourselves
Alternatives considered
- Manually clearing the cache before a request
- Manually clearing the cache after a request
How important is this feature to you?
- Nice to have
- Would make my life a lot easier
- I cannot use swup without it
Rasso Hilber commented
I'd vote for 1b, to keep it simple
Philipp Daun commented
I've switched the proposed feature to a slightly different API that works well with the visit object:
cache: boolean | { read: boolean, write: boolean }