Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

useQuery with onCompleted: infinite loop. #4044

Open
vendramini opened this issue Jul 17, 2020 · 0 comments
Open

useQuery with onCompleted: infinite loop. #4044

vendramini opened this issue Jul 17, 2020 · 0 comments

Comments

@vendramini
Copy link

Hello!

I had this code before updating to v3:

const {
        data: dataEvents,
        loading: loadingEvents,
        error: errorEvents,
    } = useQuery(
        getEventsQuery,
        {
            fetchPolicy: "network-only",
            onCompleted() {
                //do stuffs
            }
        }
    );

And it works without problem. After updating to v3, even an empty onCompleted callback produces an infinite loop in my component, requesting the query forever. If I take the onCompleted off, everything works well.

I found a related issue: #3353 (comment) but the fix didn't work for me.

Thanks :)

System:
    OS: Linux 5.0 Linux Mint 19.1 (Tessa)
  Binaries:
    Node: 12.16.3 - ~/.nvm/versions/node/v12.16.3/bin/node
    Yarn: 1.21.1 - /usr/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.3/bin/npm
  Browsers:
    Chrome: 83.0.4103.116
    Firefox: 78.0.1
  npmPackages:
    @apollo/client: ^3.0.1 => 3.0.1 
    apollo-upload-client: ^13.0.0 => 13.0.0 
    next-with-apollo: ^5.1.0 => 5.1.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant