Apollo-client: Function in onCompleted fires when skip is true

Created on 8 Apr 2020  ·  6Comments  ·  Source: apollographql/apollo-client

Hi all, I'm experiencing the same issue as reported here by @xiaoyu-tamu:
https://github.com/apollographql/react-apollo/issues/3814

I believe it was reported in the wrong place (under the old react-apollo repo), so I am reposting here for visibility.

Intended outcome:
Function specified in onCompleted should not fire when the skip option is _true_.

Actual outcome:
Function specified in onCompleted fires even when skip option is _true_

How to reproduce the issue:
@xiaoyu-tamu's minimal codesandbox
https://codesandbox.io/s/jolly-mclean-rtrwj

const { loading, data } = useQuery(ALL_PEOPLE, {
    skip: true,
    onCompleted: () => {
      alert("skipped but onComplete fired");
    }
  });

Versions
3.0.0-beta.24 (codesandbox minimal reproduction)
3.0.0-beta.43 (reproduced in my own project)

System:
OS: macOS 10.15.3
Binaries:
Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
Yarn: 1.22.4 - ~/Desktop/{redacted}/node_modules/.bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
Browsers:
Chrome: 80.0.3987.163
Firefox: 74.0
Safari: 13.0.5
npmPackages:
@apollo/client: ^3.0.0-beta.43 => 3.0.0-beta.43
apollo-link-error: ^1.1.12 => 1.1.12
apollo-link-token-refresh: ^0.2.7 => 0.2.7

⚛️ React-related ✔ confirmed 🐞 bug

Most helpful comment

This has been fixed in https://github.com/apollographql/apollo-client/pull/6589 but we're in a code freeze as we prep for the 3.0 launch tomorrow, so this fix won't make it into 3.0. We'll have it out in 3.0.1 right after the 3.0 launch. Thanks all!

All 6 comments

Yeah, can verify it's still happening on 3.0.0-beta.31

Hi, I am also experiencing this issue.

Versions
apollo-client: 2.6.8
@apollo/react-hooks: 3.1.5

Same here with @apollo/react-hooks 3.1.5

It is still in @apollo/client 3.0.0-beta.44

This has been fixed in https://github.com/apollographql/apollo-client/pull/6589 but we're in a code freeze as we prep for the 3.0 launch tomorrow, so this fix won't make it into 3.0. We'll have it out in 3.0.1 right after the 3.0 launch. Thanks all!

The fix for this is now out in @apollo/[email protected]. Thanks!

Was this page helpful?
0 / 5 - 0 ratings