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

useQuery with onCompleted: infinite loop. #4044

@vendramini

Description

@vendramini

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions