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

Prefer the callbacks passed to the execute function returned from useMutation #10425

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

jerelmiller
Copy link
Member

@jerelmiller jerelmiller commented Jan 9, 2023

Closes #10287

Prefer calling the onError and onCompleted functions passed to the execute function returned by the useMutation. Currently both the callbacks passed to the execute function and the callbacks passed to the hook itself are called. According to our docs, this should not happen as the options passed to the execute function should override the hook options.

Checklist:

  • If this PR contains changes to the library itself (not necessary for e.g. docs updates), please include a changeset (see CONTRIBUTING.md)
  • If this PR is a new feature, please reference an issue where a consensus about the design was reached (not necessary for small changes)
  • Make sure all of the significant new logic is covered by tests

@changeset-bot
Copy link

changeset-bot bot commented Jan 9, 2023

🦋 Changeset detected

Latest commit: 82c8600

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@apollo/client Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@alessbell alessbell left a comment

Choose a reason for hiding this comment

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

🙌

@jerelmiller jerelmiller force-pushed the usemutation-onerror-called-incorrectly branch from 5b811ec to 1cdf0b0 Compare January 10, 2023 17:21
@jerelmiller jerelmiller merged commit 86e35a6 into main Jan 12, 2023
@jerelmiller jerelmiller deleted the usemutation-onerror-called-incorrectly branch January 12, 2023 06:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

useMutation - onError callbacks both called in hook and mutate options
2 participants