urql-graphql / urql

The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

Home Page:https://urql.dev/goto/docs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

persistedExchange(APQ) doesn't work with cacheExchange due to Document Caching

soleo opened this issue · comments

Describe the bug

with the following setup for Client

const client = new Client({
  url: 'https://trygql.formidable.dev/graphql/apq-weather',
  exchanges: [
    cacheExchange,
    persistedExchange({
      preferGetForPersistedQueries: true,
    }),
    fetchExchange,
  ],
});

It would always hit the documentCache for tries.

Reproduction

https://github.com/soleo/urql/tree/bug/apq-with-cache/examples/with-apq-cache

Urql version

@urql/exchange-persisted 4.1.0

Validations

  • I can confirm that this is a bug report, and not a feature request, RFC, question, or discussion, for which GitHub Discussions should be used
  • Read the docs.
  • Follow our Code of Conduct

I'm not sure what you mean by

It would always hit the documentCache for tries.

It's expected for a query operation to be checked against the configured cache exchange, depending on the request policy that's used

#3281 Got answers from the discussion there. We can close this issue. It is probably me not using requestPolicy correctly here.