React-query: Retry with useMutation

Created on 19 Apr 2020  路  8Comments  路  Source: tannerlinsley/react-query

Hi Tanner,

Is there any exposed control over how useMutation handles retries? It seems to be getting the same defaults as useQuery but the docs do not mention any option to customize it.

Thanks,
Thibaut

documentation

Most helpful comment

Whichever is less of an addition to the docs. So it think the former for now. Things will get better when I separate their configuration areas.

All 8 comments

Me again.

Was checking the code to see what adding this would that entail, realized it's way over my head but looks like you've got a pretty efficient abstraction that make queries and mutations be the same thing under the hood (?). So I tried stuffing a retry option to useMutation and it just works TM. 馃憦

Improving the docs might be something easier to contribute so if you're keen I can do that. Just that this may not be specific to retry, seems to me a lot more options are actually applicable. How would you want to proceed?

I actually need to make some changes actually to make the defaults separate in some places. But improving the docs for now would be great!

What would you prefer:

  • point out in useMutation options that it inherits other options that are documented in useQuery
  • duplicate the options for now

Also do you happen to know which options are applicable to useMutation?

Whichever is less of an addition to the docs. So it think the former for now. Things will get better when I separate their configuration areas.

Looks like this was removed. Is there currently a way to retry a usemutation?

Looks like this was removed. Is there currently a way to retry a usemutation?

I have the same question.

Looks like this was removed. Is there currently a way to retry a usemutation?

I have the same question.

Same here @tannerlinsley any way to retry mutations?

Mutations never had retries. To accomplish this, you鈥檒l have to build your own promise retry wrapper. React Query doesn鈥檛 ship with a retry for mutations for a variety of reasons, most of them based on the non-idempotent nature of most mutations.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CreativeTechGuy picture CreativeTechGuy  路  3Comments

benediktviebahn picture benediktviebahn  路  4Comments

bgazzera picture bgazzera  路  4Comments

longprao picture longprao  路  3Comments

ivowork picture ivowork  路  5Comments