Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent useLazyQuery from making duplicate requests when execution function first called #9684

Merged
merged 5 commits into from
May 5, 2022

Conversation

benjamn
Copy link
Member

@benjamn benjamn commented May 5, 2022

This PR should fix the following issues:

As justification for #9669, none of our error policies say anything about throwing errors; they just control whether/when the result.data and/or result.error properties will be defined. Throwing an error is similar to the default policy, none, but needlessly discards result properties other than result.error. If you want a rejected Promise, attach a then callback and throw result.error when it's defined.

I'm giving this justification because I am aware it stands in conflict with an issue we recently "fixed" (perhaps a bit too hastily): #9142 (comment)

This perhaps gives some reassurance the goals of issue #9142 are still
achievable, in the sense that network errors can be obtained from the
Promise returned by the useLazyQuery execution function, even if those
errors are not thrown (and the Promise is never rejected).
Copy link
Contributor

@brainkim brainkim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@benjamn benjamn merged commit f9097a2 into main May 5, 2022
@benjamn benjamn deleted the issue-9655-duplicate-useLazyQuery-first-request branch May 5, 2022 22:29
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants