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

fix: added default client errorPolicy check to onError hook #1318

Merged
merged 1 commit into from
May 3, 2022

Conversation

NataliaTepluhina
Copy link
Member

As described in #1316, currently onResult hook is triggered on query error if no errorPolicy is specified in query options. Setting errorPolicy to none in the Apollo Client defaultOptions doesn't have any effect - even if we set it to none explicitly, we still can see onResult hook triggered (here is a sandbox which reproduces this bug)

This PR attempts to fix two issues:

  1. If errorPolicy is undefined for both client and query options, we default it to none to be consistent with Apollo Client defaults.
  2. If errorPolicy is not defined in query options, we also check client defaultOptions for it.

Close #1316

@NataliaTepluhina NataliaTepluhina changed the title Added default client errorPolicy check to onError hook fix: added default client errorPolicy check to onError hook Feb 9, 2022
@Akryum Akryum merged commit 61261bc into vuejs:v4 May 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4: onResult is called on error, but not if setting errorPolicy is none (which should be default)
2 participants