Skip to content

mutation callback called twice #1604

Answered by vicary
hyusetiawan asked this question in Q&A
Discussion options

You must be logged in to vote

The first callback is designed for GQty to collect the mutation contents, please only do query inputs and field selections there. GQty may call it multiple times for each fetch, because of how React rendering works. (isLoading is one of the factors to consider)

  1. If you want to run some code only after a successful response, you may use the onComplete callback.
  2. Likewise, if you want to run codes on a server error response, you may use the onError callback.

Everything thrown from your query fetcher is considered a server error, so you may further customize how it behaves there.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@vicary
Comment options

Answer selected by hyusetiawan
@hyusetiawan
Comment options

@vicary
Comment options

@hyusetiawan
Comment options

@vicary
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants