apollo-link
apollo-link copied to clipboard
queryDeduplication
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?
Turning off query deduplication on composed GraphQL query does not work in my case as well. I am using react-apollo: 2.1.0
.
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: { ... },
});
I'm having the same issue.
Hey, Pull request has been opened about this issue :)