contiamo / restful-react

A consistent, declarative way of interacting with RESTful backends, featuring code-generation from Swagger and OpenAPI specs 🔥
MIT License
1.87k stars 109 forks source link

useMutate should take a debounce parameter #379

Open malko opened 2 years ago

malko commented 2 years ago

Is your feature request related to a problem? Please describe. I find useful the debounce parameter in useGet and would appreciate to have it on useMutate too, or i'm i missing the point to achieve this.

Describe the solution you'd like I'd like to be able to pass a debounce parameter to useMutate like this:

const {mutate, error} = useMutate({
  verb: 'PATCH',
  path: ({id}) => `/entity/${id}`,
  debounce: true
})

Describe alternatives you've considered using useDebounceCallback may be an option, but it force me to have another dependencies I don't require otherwise at the moment.

fabien0102 commented 2 years ago

Indeed, we don’t have any debounce property on useMutate. So far I don’t really have the time to work on this project anymore but I’m always happy to review PR if you want to take care of this 😃