Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subscribeToMore shouldn't try to update the cache when useQuery's fetchPolicy is set to "no-cache" #8019

Open
jimmycrequer opened this issue Apr 22, 2021 · 0 comments
Labels

Comments

@jimmycrequer
Copy link

jimmycrequer commented Apr 22, 2021

Intended outcome:

When setting fetchPolicy to "no-cache" in useQuery, I expect Apollo client not trying to update the cache on subscribeToMore subscription data.

Actual outcome:

Apollo Client is writing the result of the subscription data into the cache.

How to reproduce the issue:

const { data, subscribeToMore } = useQuery(MY_QUERY, {
    fetchPolicy: "no-cache",
    nextFetchPolicy: "no-cache",
});

useEffect(
    () =>
      subscribeToMore({
        document: MY_EVENT,
        updateQuery: (prev, { subscriptionData }) => {
          // do stuff

          return null; // I shouldn't need to return anything
        }
      }),
    [subscribeToMore]
  );

Versions

  System:
    OS: Windows 10 10.0.19041
  Binaries:
    Node: 15.8.0 - ~\AppData\Local\Volta\tools\image\node\15.8.0\node.EXE
    Yarn: 1.22.10 - ~\Documents\workspace\GOunite\v3\client\node_modules\.bin\yarn.CMD
    npm: 7.7.5 - ~\AppData\Local\Volta\tools\image\npm\7.7.5\bin\npm.CMD
  Browsers:
    Chrome: 89.0.4389.114
    Edge: Spartan (44.19041.423.0), Chromium (90.0.818.42)
  npmPackages:
    @apollo/client: 3.4.0-beta.23 => 3.3.15
    apollo: 2.32.5 => 2.32.5
    apollo-cache-persist: 0.1.1 => 0.1.1
    apollo-upload-client: 14.1.3 => 14.1.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants