question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Function in onCompleted fires when skip is true

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:8
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
hwillsoncommented, Jul 14, 2020

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!

2reactions
hwillsoncommented, Jul 15, 2020

The fix for this is now out in @apollo/client@3.0.1. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Queries - Apollo GraphQL Docs
This article shows how to fetch GraphQL data in React with the useQuery hook and attach the result to your UI. You'll also...
Read more >
onCompleted callback is not calling for 2nd ... - Stack Overflow
It seems to be a known issue that Apollo's onCompleted option works differently between queries fulfilled over the network and by the cache....
Read more >
webNavigation.onCompleted - Mozilla - MDN Web Docs
Fired when a document, including the resources it refers to, is completely loaded and initialized. This is equivalent to the DOM load event....
Read more >
chrome.webNavigation - Chrome Developers
If the reference fragment of a frame is changed, a onReferenceFragmentUpdated event is fired. This event can fire any time after onDOMContentLoaded ,...
Read more >
Untitled
Actual outcome: onCompleted passed to mutate function is not called. log ... and pass in the result of the first query into the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found