Skip to content

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

Description

@skrabe

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.

Activity

  1. captbaritone commented on Jan 23, 2025

    @captbaritone
    Contributor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions