fix: conform moved code to eslint indent/quotes, 4-arg mutation callbacks
- eslint --fix on branch-changed backend files (indent shift from the module-wrapper nesting in decomposed files); backend lint now 904 errors vs 1,315 on main - useMutationWithToast forwards all four TanStack v5 callback args (tsc -b strict build flagged the 3-arg passthrough)
This commit is contained in:
@@ -47,7 +47,7 @@ export function useMutationWithToast<
|
||||
|
||||
return useMutation<TData, TError, TVariables, TContext>({
|
||||
...mutationOptions,
|
||||
onSuccess: (data, variables, context) => {
|
||||
onSuccess: (data, variables, onMutateResult, context) => {
|
||||
invalidateKeys?.forEach((queryKey) => {
|
||||
queryClient.invalidateQueries({ queryKey });
|
||||
});
|
||||
@@ -56,9 +56,9 @@ export function useMutationWithToast<
|
||||
typeof successMessage === 'function' ? successMessage(data, variables) : successMessage
|
||||
);
|
||||
}
|
||||
onSuccess?.(data, variables, context);
|
||||
onSuccess?.(data, variables, onMutateResult, context);
|
||||
},
|
||||
onError: (error, variables, context) => {
|
||||
onError: (error, variables, onMutateResult, context) => {
|
||||
const message =
|
||||
typeof errorMessage === 'function'
|
||||
? errorMessage(error)
|
||||
@@ -67,7 +67,7 @@ export function useMutationWithToast<
|
||||
(error instanceof Error ? error.message : undefined) ||
|
||||
'An unexpected error occurred';
|
||||
toast.error(message);
|
||||
onError?.(error, variables, context);
|
||||
onError?.(error, variables, onMutateResult, context);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user