@@ -91,11 +91,6 @@ export const useUpdateMany = <
9191 mutationFn : customMutationFn ,
9292 ...mutationOptions
9393 } = options ;
94- const wrappedCustomMutationFn = customMutationFn as
95- | ( (
96- params : Partial < UseUpdateManyMutateParams < RecordType > >
97- ) => Promise < Array < RecordType [ 'id' ] > > )
98- | undefined ;
9994
10095 const dataProviderUpdateMany = useEvent (
10196 ( resource : string , params : UpdateManyParams < RecordType > ) =>
@@ -112,9 +107,9 @@ export const useUpdateMany = <
112107 ...mutationOptions ,
113108 mutationKey : [ resource , 'updateMany' , params ] ,
114109 mutationMode,
115- mutationFn : wrappedCustomMutationFn
110+ mutationFn : customMutationFn
116111 ? async params => ( {
117- data : await wrappedCustomMutationFn ( params ) ,
112+ data : await customMutationFn ( params ) ,
118113 } )
119114 : ( { resource, ...params } ) => {
120115 if ( resource == null ) {
@@ -245,9 +240,9 @@ export const useUpdateMany = <
245240 // Immediately get the function with middlewares applied so that even if the middlewares gets unregistered (because of a redirect for instance),
246241 // we still have them applied when users have called the mutate function.
247242 const mutateWithMiddlewares = getMutateWithMiddlewares (
248- wrappedCustomMutationFn
243+ customMutationFn
249244 ? ( resource , params ) =>
250- wrappedCustomMutationFn ( {
245+ customMutationFn ( {
251246 resource,
252247 ...params ,
253248 } as Partial <
@@ -305,11 +300,17 @@ export interface UseUpdateManyMutateParams<RecordType extends RaRecord = any> {
305300export type UseUpdateManyOptions <
306301 RecordType extends RaRecord = any ,
307302 MutationError = unknown ,
308- > = UseMutationOptions <
309- Array < RecordType [ 'id' ] > ,
310- MutationError ,
311- Partial < UseUpdateManyMutateParams < RecordType > >
303+ > = Omit <
304+ UseMutationOptions <
305+ Array < RecordType [ 'id' ] > ,
306+ MutationError ,
307+ Partial < UseUpdateManyMutateParams < RecordType > >
308+ > ,
309+ 'mutationFn'
312310> & {
311+ mutationFn ?: (
312+ params : Partial < UseUpdateManyMutateParams < RecordType > >
313+ ) => Promise < Array < RecordType [ 'id' ] > > ;
313314 mutationMode ?: MutationMode ;
314315 returnPromise ?: boolean ;
315316 getMutateWithMiddlewares ?: <
0 commit comments