This repository has been archived by the owner on Apr 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 787
useQuery: onCompleted called on every update #3353
Comments
Ah. I see where the issue lies. |
I noticed the same issue. This seems to be solved by passing variables: {} to the query options in the case where the query has no variables as in the example. |
@PovilasSlekys Thanks, you saved a few hours of my life! |
@PovilasSlekys I don't know why but it's works! |
This has been fixed by #3419, and will be released shortly. Thanks! |
This was referenced Sep 6, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Intended outcome:
Updating some state in
onCompleted
based on the result from a query.Actual outcome:
Ending up in an endless loop, since every update to the component which calls the query, results in
onCompleted
getting called again.How to reproduce the issue:
https://codesandbox.io/embed/apollo-client-error-template-78jbq
Pay attention to the console.
Version
@apollo/react-hooks 3.0.0
The text was updated successfully, but these errors were encountered: