Apollo angular client always using cache

Viewed 1139

I'm using apollo angular client with the InMemoryCache. I have some watchQuery's for which I want to disable caching. I've setup my client as follows:

link: httpLink.create({uri}),
    cache: new InMemoryCache(),
    ssrMode: false,
    ssrForceFetchDelay:0,
    defaultOptions: {
      watchQuery: {
        fetchPolicy: 'no-cache',
        errorPolicy: 'ignore',
      },
      query: {
        fetchPolicy: 'no-cache',
        errorPolicy: 'all',
      },
    }

and my watchQuery looks like this:

return this.apollo.watchQuery<TestAssetListQuery>({
        query: gql`
          query {
              testAssetList {
                name,
                path,
                size
              }
          }
        `,
        fetchPolicy: "no-cache",
      }).valueChanges;

Yet, every subsequent query is pulled from cache.

I'd appreciate any advice on how to force apollo not to cache my queries.

1 Answers

Since I have not enough reputation to comment. I will try to post it.

Try using network-only instead of no-cache

Related