Search code examples
graphqlapolloreact-apolloapollo-clientgraphql-js

Is there anyway to find out why has a query from useQuery (@apollo/client) fired again?


I am using @apollo/client with react in my app, and i just upgraded it to 3.x. I am using the ApolloClient with the fetchPolicy of cache-and-network.

After the upgrade, somehow when one mutation is triggered, all the active queries (useQuery) fire and refetch the data from the server. Even if those queries are not related to the mutation that happened in any way.

Any pointers on what could be the issue or how to debug?

Is there any way to find out why has a query fired again?

Any help will be really appreciated.


Solution

  • Found a solution to this issue here

    Adding a nextFetchPolicy to cache-first fixes this and changes the behaviour or cache-and-network policy to that of apollo 2.