Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support fetch cache option #1050

Open
guybedford opened this issue Nov 22, 2024 · 2 comments
Open

Support fetch cache option #1050

guybedford opened this issue Nov 22, 2024 · 2 comments

Comments

@guybedford
Copy link
Member

We could support the specified cache option for fetch with the following:

  • 'default': This is our default so we exactly match the spec here
  • 'no-store': This is the same as CacheOverride: pass so we can fully support this
  • 'reload': Bypasses a cache check (so always goes to backend), then updates the cache - not possible, would require supporting insert without a successful transaction lookup
  • 'no-cache': Always revalidates to the backend - same as above
  • 'force-cache': Requires cache lookup ignoring staleness - not possible, but might make sense to support even if not properly implemented, since it’s kinda unobservable
  • 'only-if-cached': As above

We should likely:

  • Throw for 'reload' and 'no-cache'
  • Support 'force-cache' and 'only-if-cached' with types / documentation warnings
@harmony7
Copy link
Member

I have a concern regarding 'no-store' in conjunction with #1051 (HTTP Advanced Cache API)

If we define 'no-store' to be equivalent to CacheOverride: 'pass', then it means that fetch interaction will be bypassing the readthrough cache entirely. This means that neither the before-send nor after-send callbacks will be called. I think this would be surprising behavior from the viewpoint of a developer, because the label no-store sounds like it would do everything the same as default, except for lookup and storage.

If we do support no-store, then I would suggest that we still run the before-send, after-send, and body-transform callbacks for that request so that the developer won't be surprised.

@guybedford
Copy link
Member Author

That makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants