Skip to content
This repository has been archived by the owner on Jan 27, 2022. It is now read-only.

queryDeduplication #517

Open
gilesbradshaw opened this issue Feb 23, 2018 · 4 comments
Open

queryDeduplication #517

gilesbradshaw opened this issue Feb 23, 2018 · 4 comments

Comments

@gilesbradshaw
Copy link
Contributor

Doc says:

"Query deduplication can help reduce the number of queries that are sent over the wire. It is turned on by default, but can be turned off by passing queryDeduplication: false to the context on each requests or using the defaultOptions key on Apollo Client setup. If turned on, query deduplication happens before the query hits the network layer."

https://www.apollographql.com/docs/react/basics/network-layer.html#query-deduplication

however

new ApolloClient({
    defaultOptions: {
        queryDeduplication: false,
    }
})

has no effect

what one does is:

new ApolloClient({
    queryDeduplication: false,
})

moreover should not

import { graphql } from 'react-apollo'

  graphql(
    Query,
    {
      options: () => ({
        context: {
          // this (SHOULD) prevent the query being deduped
          // which means that requerying on reconnection works
          queryDeduplication: false,
        },
        fetchPolicy:'network-only',
      })
    }
  )

work for individual queries?

@raeesaa
Copy link

raeesaa commented Apr 2, 2018

Turning off query deduplication on composed GraphQL query does not work in my case as well. I am using react-apollo: 2.1.0.

@cesar3030
Copy link

I'm having the same issue. I don't want to turn off queryDeduplication for all my requests but only for one. I tried passing queryDeduplication: false in the context instead of inside the client options but it doesn't work.

client:

export const client = new ApolloClient({
  link,
  cache,
  resolvers,
  typeDefs,
});

Query:

const response = await client.query({
    fetchPolicy: 'no-cache',
    context: { queryDeduplication: false },
    query: GET_SIGNED_UPLOAD_URL,
    variables: { ... },
});

@igaloly
Copy link

igaloly commented May 3, 2020

I'm having the same issue.

@igaloly
Copy link

igaloly commented May 10, 2020

Hey,
Pull request has been opened about this issue :)

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

No branches or pull requests

4 participants