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

fetchQuery not supporting store-and-network and store-only fetch policies #4880

Open
skrabe opened this issue Jan 15, 2025 · 1 comment
Open

Comments

@skrabe
Copy link

skrabe commented Jan 15, 2025

Hi everyone,

After getting an error in my app and after looking at the fetchQuery function, I found out store-and-network and store-only fetch policies are not supported. Is there any detailed explanation on why?

Also, it would be nice to have it covered in the docs if it stays unsupported.

@captbaritone
Copy link
Contributor

captbaritone commented Jan 23, 2025

Sounds like this might be a bug in the community typescript types. In Flow we only allow 'store-or-network' | 'network-only'. The idea is that fetchQuery is explicitly about making network requests. https://github.com/facebook/relay/blob/main/packages/relay-runtime/util/RelayRuntimeTypes.js#L72

If someone is up to it, it would be great if we could get:

  1. An update to the TypeScript types
  2. An update to the docs here:
    slug: /api-reference/fetch-query/
    documenting the fetchPolicy options.

Update: I'm interpreting "After getting an error in my app" as you got a runtime error. If you got a type error, than maybe item 1 is not needed.

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