TanStackT
TanStack4y ago
14 replies
faint-white

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
Was this page helpful?