T
TanStack•3y ago
xenial-black

useMutation implementation question

Sorry for similar name as the last question, but this is entirely different. In the useMutation implementation I can see this code: watch( [() => arg1, () => arg2, () => arg3], () => { observer.setOptions( queryClient.defaultMutationOptions(parseMutationArgs(arg1, arg2, arg3)), ) }, { deep: true }, ) I am confused however why we would watch these arguments as they cannot be reactive according to the type signature. If I were to pass a reactive mutationKey function to force this watcher to trigger what would that look like? thanks in advance
11 Replies
fascinating-indigo
fascinating-indigo•3y ago
Currently useMutation lacks proper ts signature, and there was an open PR to fix it in the old repository: https://github.com/DamianOsipiuk/vue-query/pull/253
xenial-black
xenial-blackOP•3y ago
Thank you very much I implemented a fix for useMutation based on the old issue, how can we move forward?
fascinating-indigo
fascinating-indigo•3y ago
Please open a PR in @tanstack/query repo.
xenial-black
xenial-blackOP•3y ago
it says I don't have write access to the repo
fascinating-indigo
fascinating-indigo•3y ago
You need to fork the repo, push new branch to your fork and then create PullRequest to the original repository from your fork.
xenial-black
xenial-blackOP•3y ago
kk thanks
xenial-black
xenial-blackOP•3y ago
GitHub
Make use mutate reactive to argument changes by matthewhausman · Pu...
Definitely need someone to help verify this implementation as I am not intimately familiar with how tanstack query is used professionally, only generally familiar. The parseMutationArgs function wo...
fascinating-indigo
fascinating-indigo•3y ago
I will check that tomorrow
xenial-black
xenial-blackOP•3y ago
Hey @MrMentor let me know when we can discuss 🙂 @MrMentor Hey, any chance could get another round of feedback on that PR? Hey @MrMentor forgot to make myself a contributor lol... made another PR 😂
fascinating-indigo
fascinating-indigo•3y ago
people are added trough the bot, manual changes are not necessary
xenial-black
xenial-blackOP•3y ago
Oh thanks sorry

Did you find this page helpful?