From 035cda8130297bb155e6a7746e8ce5f27f8bb96c Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Thu, 25 Sep 2025 11:32:24 +0200 Subject: [PATCH 1/5] Fix incompatibility with latest react-query --- examples/simple/package.json | 4 +- packages/ra-core/package.json | 4 +- .../controller/create/useCreateController.ts | 10 ++- .../src/controller/edit/useEditController.ts | 10 ++- .../ra-core/src/dataProvider/useCreate.ts | 74 +++++++++---------- .../ra-core/src/dataProvider/useDelete.ts | 74 +++++++++---------- .../ra-core/src/dataProvider/useDeleteMany.ts | 71 +++++++++--------- .../ra-core/src/dataProvider/useUpdate.ts | 74 +++++++++---------- .../ra-core/src/dataProvider/useUpdateMany.ts | 73 +++++++++--------- packages/ra-core/src/types.ts | 8 +- packages/ra-no-code/package.json | 2 +- packages/ra-ui-materialui/package.json | 2 +- .../src/button/DeleteWithConfirmButton.tsx | 8 +- packages/react-admin/package.json | 2 +- yarn.lock | 52 ++++++------- 15 files changed, 230 insertions(+), 238 deletions(-) diff --git a/examples/simple/package.json b/examples/simple/package.json index ff3683ce7e5..bb41a1e9acd 100644 --- a/examples/simple/package.json +++ b/examples/simple/package.json @@ -12,8 +12,8 @@ "dependencies": { "@mui/icons-material": "^5.16.12", "@mui/material": "^5.16.12", - "@tanstack/react-query": "^5.83.0", - "@tanstack/react-query-devtools": "^5.83.0", + "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query-devtools": "^5.90.2", "fakerest": "^4.1.3", "jsonexport": "^3.2.0", "lodash": "~4.17.5", diff --git a/packages/ra-core/package.json b/packages/ra-core/package.json index 311d9eede9e..45c173bc58e 100644 --- a/packages/ra-core/package.json +++ b/packages/ra-core/package.json @@ -28,7 +28,7 @@ }, "devDependencies": { "@hookform/resolvers": "^3.2.0", - "@tanstack/react-query-devtools": "^5.21.7", + "@tanstack/react-query-devtools": "^5.90.2", "@testing-library/react": "^15.0.7", "@types/jest": "^29.5.2", "@types/jscodeshift": "^0.11.11", @@ -58,7 +58,7 @@ "react-router-dom": "^6.28.1 || ^7.1.1" }, "dependencies": { - "@tanstack/react-query": "^5.83.0", + "@tanstack/react-query": "^5.90.2", "date-fns": "^3.6.0", "eventemitter3": "^5.0.1", "inflection": "^3.0.0", diff --git a/packages/ra-core/src/controller/create/useCreateController.ts b/packages/ra-core/src/controller/create/useCreateController.ts index 9ee07aee7f8..65844cce979 100644 --- a/packages/ra-core/src/controller/create/useCreateController.ts +++ b/packages/ra-core/src/controller/create/useCreateController.ts @@ -92,10 +92,11 @@ export const useCreateController = < MutationOptionsError, ResultRecordType >(resource, undefined, { - onSuccess: async (data, variables, context) => { + onSuccess: async (...args) => { if (onSuccess) { - return onSuccess(data, variables, context); + return onSuccess(...args); } + const [data] = args; notify(`resources.${resource}.notifications.created`, { type: 'info', messageArgs: { @@ -108,10 +109,11 @@ export const useCreateController = < }); redirect(finalRedirectTo, resource, data.id, data); }, - onError: (error: MutationOptionsError, variables, context) => { + onError: (...args) => { if (onError) { - return onError(error, variables, context); + return onError(...args); } + const [error] = args; // Don't trigger a notification if this is a validation error // (notification will be handled by the useNotifyIsFormInvalid hook) const validationErrors = (error as HttpError)?.body?.errors; diff --git a/packages/ra-core/src/controller/edit/useEditController.ts b/packages/ra-core/src/controller/edit/useEditController.ts index fd2ef28212d..2ec6f3ad8c2 100644 --- a/packages/ra-core/src/controller/edit/useEditController.ts +++ b/packages/ra-core/src/controller/edit/useEditController.ts @@ -175,10 +175,11 @@ export const useEditController = < resource, recordCached, { - onSuccess: async (data, variables, context) => { + onSuccess: async (...args) => { if (onSuccess) { - return onSuccess(data, variables, context); + return onSuccess(...args); } + const [data] = args; notify(`resources.${resource}.notifications.updated`, { type: 'info', messageArgs: { @@ -191,10 +192,11 @@ export const useEditController = < }); redirect(redirectTo, resource, data.id, data); }, - onError: (error, variables, context) => { + onError: (...args) => { if (onError) { - return onError(error, variables, context); + return onError(...args); } + const [error] = args; // Don't trigger a notification if this is a validation error // (notification will be handled by the useNotifyIsFormInvalid hook) const validationErrors = (error as HttpError)?.body?.errors; diff --git a/packages/ra-core/src/dataProvider/useCreate.ts b/packages/ra-core/src/dataProvider/useCreate.ts index 0ea0282e3a1..676b7caf413 100644 --- a/packages/ra-core/src/dataProvider/useCreate.ts +++ b/packages/ra-core/src/dataProvider/useCreate.ts @@ -184,12 +184,10 @@ export const useCreate = < .then(({ data }) => data); }, ...mutationOptions, - onMutate: async ( - variables: Partial> - ) => { + onMutate: async (...args) => { if (mutationOptions.onMutate) { const userContext = - (await mutationOptions.onMutate(variables)) || {}; + (await mutationOptions.onMutate(...args)) || {}; return { snapshot: snapshot.current, // @ts-ignore @@ -200,27 +198,27 @@ export const useCreate = < return { snapshot: snapshot.current }; } }, - onError: (error, variables, context: { snapshot: Snapshot }) => { + onError: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , onMutateResult] = args; // If the mutation fails, use the context returned from onMutate to rollback - context.snapshot.forEach(([key, value]) => { - queryClient.setQueryData(key, value); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([key, value]) => { + queryClient.setQueryData(key, value); + } + ); } if (callTimeOnError.current) { - return callTimeOnError.current(error, variables, context); + return callTimeOnError.current(...args); } if (mutationOptions.onError) { - return mutationOptions.onError(error, variables, context); + return mutationOptions.onError(...args); } // call-time error callback is executed by react-query }, - onSuccess: ( - data: ResultRecordType, - variables: Partial> = {}, - context: unknown - ) => { + onSuccess: (...args) => { if (mode.current === 'pessimistic') { + const [data, variables] = args; const { resource: callTimeResource = resource } = variables; queryClient.setQueryData( [callTimeResource, 'getOne', { id: String(data.id) }], @@ -243,38 +241,26 @@ export const useCreate = < mutationOptions.onSuccess && !hasCallTimeOnSuccess.current ) { - mutationOptions.onSuccess(data, variables, context); + mutationOptions.onSuccess(...args); } } }, - onSettled: ( - data, - error, - variables, - context: { snapshot: Snapshot } - ) => { + onSettled: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , , onMutateResult] = args; // Always refetch after error or success: - context.snapshot.forEach(([queryKey]) => { - queryClient.invalidateQueries({ queryKey }); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([queryKey]) => { + queryClient.invalidateQueries({ queryKey }); + } + ); } if (callTimeOnSettled.current) { - return callTimeOnSettled.current( - data, - error, - variables, - context - ); + return callTimeOnSettled.current(...args); } if (mutationOptions.onSettled) { - return mutationOptions.onSettled( - data, - error, - variables, - context - ); + return mutationOptions.onSettled(...args); } }, }); @@ -409,7 +395,12 @@ export const useCreate = < onSuccess( callTimeData as unknown as ResultRecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'create', params], + meta: mutationOptions.meta, + } ); } else if ( mutationOptions.onSuccess && @@ -418,7 +409,12 @@ export const useCreate = < mutationOptions.onSuccess( callTimeData as unknown as ResultRecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'create', params], + meta: mutationOptions.meta, + } ); } }, 0); diff --git a/packages/ra-core/src/dataProvider/useDelete.ts b/packages/ra-core/src/dataProvider/useDelete.ts index 3847b696366..083015bd28f 100644 --- a/packages/ra-core/src/dataProvider/useDelete.ts +++ b/packages/ra-core/src/dataProvider/useDelete.ts @@ -227,12 +227,10 @@ export const useDelete = < .then(({ data }) => data); }, ...mutationOptions, - onMutate: async ( - variables: Partial> - ) => { + onMutate: async (...args) => { if (mutationOptions.onMutate) { const userContext = - (await mutationOptions.onMutate(variables)) || {}; + (await mutationOptions.onMutate(...args)) || {}; return { snapshot: snapshot.current, // @ts-ignore @@ -243,29 +241,25 @@ export const useDelete = < return { snapshot: snapshot.current }; } }, - onError: ( - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onError: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , onMutateResult] = args; // If the mutation fails, use the context returned from onMutate to rollback - context.snapshot.forEach(([key, value]) => { - queryClient.setQueryData(key, value); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([key, value]) => { + queryClient.setQueryData(key, value); + } + ); } if (mutationOptions.onError && !hasCallTimeOnError.current) { - return mutationOptions.onError(error, variables, context); + return mutationOptions.onError(...args); } // call-time error callback is executed by react-query }, - onSuccess: ( - data: RecordType, - variables: Partial> = {}, - context: unknown - ) => { + onSuccess: (...args) => { if (mode.current === 'pessimistic') { + const [, variables] = args; // update the getOne and getList query cache with the new result const { resource: callTimeResource = resource, @@ -280,29 +274,23 @@ export const useDelete = < mutationOptions.onSuccess && !hasCallTimeOnSuccess.current ) { - mutationOptions.onSuccess(data, variables, context); + mutationOptions.onSuccess(...args); } // call-time success callback is executed by react-query } }, - onSettled: ( - data: RecordType, - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onSettled: (...args) => { + const [, , , onMutateResult] = args; + // Always refetch after error or success: - context.snapshot.forEach(([queryKey]) => { - queryClient.invalidateQueries({ queryKey }); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([queryKey]) => { + queryClient.invalidateQueries({ queryKey }); + } + ); if (mutationOptions.onSettled && !hasCallTimeOnSettled.current) { - return mutationOptions.onSettled( - data, - error, - variables, - context - ); + return mutationOptions.onSettled(...args); } }, }); @@ -397,15 +385,25 @@ export const useDelete = < setTimeout(() => { if (callTimeOptions.onSuccess) { callTimeOptions.onSuccess( - callTimePreviousData, + callTimePreviousData as RecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'delete', params], + meta: mutationOptions.meta, + } ); } else if (mutationOptions.onSuccess) { mutationOptions.onSuccess( - callTimePreviousData, + callTimePreviousData as RecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'delete', params], + meta: mutationOptions.meta, + } ); } }, 0); diff --git a/packages/ra-core/src/dataProvider/useDeleteMany.ts b/packages/ra-core/src/dataProvider/useDeleteMany.ts index 4b7d4080132..348745743fd 100644 --- a/packages/ra-core/src/dataProvider/useDeleteMany.ts +++ b/packages/ra-core/src/dataProvider/useDeleteMany.ts @@ -256,12 +256,10 @@ export const useDeleteMany = < .then(({ data }) => data || []); }, ...mutationOptions, - onMutate: async ( - variables: Partial> - ) => { + onMutate: async (...args) => { if (mutationOptions.onMutate) { const userContext = - (await mutationOptions.onMutate(variables)) || {}; + (await mutationOptions.onMutate(...args)) || {}; return { snapshot: snapshot.current, // @ts-ignore @@ -272,29 +270,27 @@ export const useDeleteMany = < return { snapshot: snapshot.current }; } }, - onError: ( - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onError: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , onMutateResult] = args; + // If the mutation fails, use the context returned from onMutate to rollback - context.snapshot.forEach(([key, value]) => { - queryClient.setQueryData(key, value); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([key, value]) => { + queryClient.setQueryData(key, value); + } + ); } if (mutationOptions.onError && !hasCallTimeOnError.current) { - return mutationOptions.onError(error, variables, context); + return mutationOptions.onError(...args); } // call-time error callback is executed by react-query }, - onSuccess: ( - data: RecordType['id'][], - variables: Partial> = {}, - context: unknown - ) => { + onSuccess: (...args) => { if (mode.current === 'pessimistic') { + const [, variables] = args; + // update the getOne and getList query cache with the new result const { resource: callTimeResource = resource, @@ -309,31 +305,24 @@ export const useDeleteMany = < mutationOptions.onSuccess && !hasCallTimeOnSuccess.current ) { - mutationOptions.onSuccess(data, variables, context); + mutationOptions.onSuccess(...args); } // call-time success callback is executed by react-query } }, - onSettled: ( - data: RecordType['id'][], - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onSettled: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , , onMutateResult] = args; // Always refetch after error or success: - context.snapshot.forEach(([queryKey]) => { - queryClient.invalidateQueries({ queryKey }); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([queryKey]) => { + queryClient.invalidateQueries({ queryKey }); + } + ); } if (mutationOptions.onSettled && !hasCallTimeOnSettled.current) { - return mutationOptions.onSettled( - data, - error, - variables, - context - ); + return mutationOptions.onSettled(...args); } }, }); @@ -426,13 +415,23 @@ export const useDeleteMany = < otherCallTimeOptions.onSuccess( callTimeIds, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'deleteMany', params], + meta: mutationOptions.meta, + } ); } else if (mutationOptions.onSuccess) { mutationOptions.onSuccess( callTimeIds, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'deleteMany', params], + meta: mutationOptions.meta, + } ); } }, 0); diff --git a/packages/ra-core/src/dataProvider/useUpdate.ts b/packages/ra-core/src/dataProvider/useUpdate.ts index 1e7388fe53f..b265a4cedc9 100644 --- a/packages/ra-core/src/dataProvider/useUpdate.ts +++ b/packages/ra-core/src/dataProvider/useUpdate.ts @@ -237,12 +237,10 @@ export const useUpdate = ( .then(({ data }) => data); }, ...mutationOptions, - onMutate: async ( - variables: Partial> - ) => { + onMutate: async (...args) => { if (mutationOptions.onMutate) { const userContext = - (await mutationOptions.onMutate(variables)) || {}; + (await mutationOptions.onMutate(...args)) || {}; return { snapshot: snapshot.current, // @ts-ignore @@ -253,28 +251,28 @@ export const useUpdate = ( return { snapshot: snapshot.current }; } }, - onError: (error, variables = {}, context: { snapshot: Snapshot }) => { + onError: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , onMutateResult] = args; // If the mutation fails, use the context returned from onMutate to rollback - context.snapshot.forEach(([key, value]) => { - queryClient.setQueryData(key, value); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([key, value]) => { + queryClient.setQueryData(key, value); + } + ); } if (callTimeOnError.current) { - return callTimeOnError.current(error, variables, context); + return callTimeOnError.current(...args); } if (mutationOptions.onError) { - return mutationOptions.onError(error, variables, context); + return mutationOptions.onError(...args); } // call-time error callback is executed by react-query }, - onSuccess: ( - data: RecordType, - variables: Partial> = {}, - context: unknown - ) => { + onSuccess: (...args) => { if (mode.current === 'pessimistic') { + const [, variables] = args; // update the getOne and getList query cache with the new result const { resource: callTimeResource = resource, @@ -292,38 +290,26 @@ export const useUpdate = ( mutationOptions.onSuccess && !hasCallTimeOnSuccess.current ) { - mutationOptions.onSuccess(data, variables, context); + mutationOptions.onSuccess(...args); } } }, - onSettled: ( - data, - error, - variables = {}, - context: { snapshot: Snapshot } - ) => { + onSettled: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , , onMutateResult] = args; // Always refetch after error or success: - context.snapshot.forEach(([queryKey]) => { - queryClient.invalidateQueries({ queryKey }); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([queryKey]) => { + queryClient.invalidateQueries({ queryKey }); + } + ); } if (callTimeOnSettled.current) { - return callTimeOnSettled.current( - data, - error, - variables, - context - ); + return callTimeOnSettled.current(...args); } if (mutationOptions.onSettled) { - return mutationOptions.onSettled( - data, - error, - variables, - context - ); + return mutationOptions.onSettled(...args); } }, }); @@ -462,7 +448,12 @@ export const useUpdate = ( onSuccess( { ...previousRecord, ...callTimeData } as RecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'update', params], + meta: mutationOptions.meta, + } ); } else if ( mutationOptions.onSuccess && @@ -471,7 +462,12 @@ export const useUpdate = ( mutationOptions.onSuccess( { ...previousRecord, ...callTimeData } as RecordType, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'update', params], + meta: mutationOptions.meta, + } ); } }, 0); diff --git a/packages/ra-core/src/dataProvider/useUpdateMany.ts b/packages/ra-core/src/dataProvider/useUpdateMany.ts index 0051e37fbc0..93b3c8f6cba 100644 --- a/packages/ra-core/src/dataProvider/useUpdateMany.ts +++ b/packages/ra-core/src/dataProvider/useUpdateMany.ts @@ -239,12 +239,10 @@ export const useUpdateMany = < .then(({ data }) => data || []); }, ...mutationOptions, - onMutate: async ( - variables: Partial> - ) => { + onMutate: async (...args) => { if (mutationOptions.onMutate) { const userContext = - (await mutationOptions.onMutate(variables)) || {}; + (await mutationOptions.onMutate(...args)) || {}; return { snapshot: snapshot.current, // @ts-ignore @@ -255,29 +253,25 @@ export const useUpdateMany = < return { snapshot: snapshot.current }; } }, - onError: ( - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onError: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , onMutateResult] = args; // If the mutation fails, use the context returned from onMutate to rollback - context.snapshot.forEach(([key, value]) => { - queryClient.setQueryData(key, value); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([key, value]) => { + queryClient.setQueryData(key, value); + } + ); } if (mutationOptions.onError && !hasCallTimeOnError.current) { - return mutationOptions.onError(error, variables, context); + return mutationOptions.onError(...args); } // call-time error callback is executed by react-query }, - onSuccess: ( - dataFromResponse: Array, - variables: Partial> = {}, - context: unknown - ) => { + onSuccess: (...args) => { if (mode.current === 'pessimistic') { + const [, variables] = args; // update the getOne and getList query cache with the new result const { resource: callTimeResource = resource, @@ -306,34 +300,23 @@ export const useUpdateMany = < mutationOptions.onSuccess && !hasCallTimeOnSuccess.current ) { - mutationOptions.onSuccess( - dataFromResponse, - variables, - context - ); + mutationOptions.onSuccess(...args); } } }, - onSettled: ( - data: Array, - error: MutationError, - variables: Partial> = {}, - context: { snapshot: Snapshot } - ) => { + onSettled: (...args) => { if (mode.current === 'optimistic' || mode.current === 'undoable') { + const [, , , onMutateResult] = args; // Always refetch after error or success: - context.snapshot.forEach(([queryKey]) => { - queryClient.invalidateQueries({ queryKey }); - }); + (onMutateResult as { snapshot: Snapshot }).snapshot.forEach( + ([queryKey]) => { + queryClient.invalidateQueries({ queryKey }); + } + ); } if (mutationOptions.onSettled && !hasCallTimeOnSettled.current) { - return mutationOptions.onSettled( - data, - error, - variables, - context - ); + return mutationOptions.onSettled(...args); } }, }); @@ -462,13 +445,23 @@ export const useUpdateMany = < otherCallTimeOptions.onSuccess( callTimeIds, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'updateMany', params], + meta: mutationOptions.meta, + } ); } else if (mutationOptions.onSuccess) { mutationOptions.onSuccess( callTimeIds, { resource: callTimeResource, ...callTimeParams }, - { snapshot: snapshot.current } + { snapshot: snapshot.current }, + { + client: queryClient, + mutationKey: [resource, 'updateMany', params], + meta: mutationOptions.meta, + } ); } }, 0); diff --git a/packages/ra-core/src/types.ts b/packages/ra-core/src/types.ts index 45c550e4df4..0dba44d3814 100644 --- a/packages/ra-core/src/types.ts +++ b/packages/ra-core/src/types.ts @@ -276,10 +276,16 @@ export type MutationMode = 'pessimistic' | 'optimistic' | 'undoable'; export type OnSuccess = ( response?: any, variables?: any, + onMutateResult?: any, context?: any ) => void; -export type OnError = (error?: any, variables?: any, context?: any) => void; +export type OnError = ( + error?: any, + variables?: any, + onMutateResult?: any, + context?: any +) => void; export type TransformData = ( data: any, diff --git a/packages/ra-no-code/package.json b/packages/ra-no-code/package.json index 207ba1b1831..11968d3b222 100644 --- a/packages/ra-no-code/package.json +++ b/packages/ra-no-code/package.json @@ -42,7 +42,7 @@ "react-dom": "^18.0.0 || ^19.0.0" }, "dependencies": { - "@tanstack/react-query": "^5.83.0", + "@tanstack/react-query": "^5.90.2", "clsx": "^2.1.1", "date-fns": "^3.6.0", "inflection": "^3.0.0", diff --git a/packages/ra-ui-materialui/package.json b/packages/ra-ui-materialui/package.json index 882d9e466e8..cbb3c9f9b13 100644 --- a/packages/ra-ui-materialui/package.json +++ b/packages/ra-ui-materialui/package.json @@ -68,7 +68,7 @@ "react-router-dom": "^6.28.1 || ^7.1.1" }, "dependencies": { - "@tanstack/react-query": "^5.83.0", + "@tanstack/react-query": "^5.90.2", "autosuggest-highlight": "^3.1.1", "clsx": "^2.1.1", "css-mediaquery": "^0.1.2", diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx index 321460686f5..bcebde08ab1 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx @@ -73,10 +73,10 @@ export const DeleteWithConfirmButton = ( mutationMode, mutationOptions: { ...otherMutationOptions, - onSuccess: (data, variables, context) => { + onSuccess: (...args) => { setOpen(false); if (onSuccess) { - onSuccess(data, variables, context); + onSuccess(...args); } else { notify( successMessage ?? @@ -96,10 +96,10 @@ export const DeleteWithConfirmButton = ( redirect(redirectTo, resource); } }, - onError: (error, variables, context) => { + onError: (error, variables, onMutateResult, context) => { setOpen(false); if (onError) { - onError(error, variables, context); + onError(error, variables, onMutateResult, context); } else { notify( typeof error === 'string' diff --git a/packages/react-admin/package.json b/packages/react-admin/package.json index fa4d935b104..e660aba850c 100644 --- a/packages/react-admin/package.json +++ b/packages/react-admin/package.json @@ -41,7 +41,7 @@ "@emotion/styled": "^11.14.0", "@mui/icons-material": "^5.16.12 || ^6.0.0 || ^7.0.0", "@mui/material": "^5.16.12 || ^6.0.0 || ^7.0.0", - "@tanstack/react-query": "^5.83.0", + "@tanstack/react-query": "^5.90.2", "ra-core": "^5.11.3", "ra-i18n-polyglot": "^5.11.3", "ra-language-english": "^5.11.3", diff --git a/yarn.lock b/yarn.lock index f7ec3fea8d4..c66e0935ff8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5224,40 +5224,40 @@ __metadata: languageName: node linkType: hard -"@tanstack/query-core@npm:5.83.0": - version: 5.83.0 - resolution: "@tanstack/query-core@npm:5.83.0" - checksum: e6dc480bc99eaca552a9ad65423788b60368cf99308681252fc7dbe42a3f2c1c978db0d3471cc3349b9112cfb4d967ace4e192a1d7e987e30c5c1ff74809c77c +"@tanstack/query-core@npm:5.90.2": + version: 5.90.2 + resolution: "@tanstack/query-core@npm:5.90.2" + checksum: 695a7450b0bb9f6dd21bebeacfc962dfc886631a3b3a13c33a842ef719b4c3dd30c15febe8c1ade6902a85e0f387c51a97570f430cc8f5c7032ff737d6410597 languageName: node linkType: hard -"@tanstack/query-devtools@npm:5.81.2": - version: 5.81.2 - resolution: "@tanstack/query-devtools@npm:5.81.2" - checksum: f942cba7bd3ecb471063cd472eeebb2ec76005feeb7e0f357b191da5ab9f769aa767bc88d4da82b2b39c4fcbb16dfed38ce3c77b6eea4d4c30405368c1120207 +"@tanstack/query-devtools@npm:5.90.1": + version: 5.90.1 + resolution: "@tanstack/query-devtools@npm:5.90.1" + checksum: 3b69e5441438acf0e753adbf187abf54b5b2e19d7c6d1e465d97278cb8c248bb86d3be193092d50414e4093cbf014093103517cb523daae003e53c867f3c11c2 languageName: node linkType: hard -"@tanstack/react-query-devtools@npm:^5.21.7, @tanstack/react-query-devtools@npm:^5.83.0": - version: 5.83.0 - resolution: "@tanstack/react-query-devtools@npm:5.83.0" +"@tanstack/react-query-devtools@npm:^5.90.2": + version: 5.90.2 + resolution: "@tanstack/react-query-devtools@npm:5.90.2" dependencies: - "@tanstack/query-devtools": "npm:5.81.2" + "@tanstack/query-devtools": "npm:5.90.1" peerDependencies: - "@tanstack/react-query": ^5.83.0 + "@tanstack/react-query": ^5.90.2 react: ^18 || ^19 - checksum: 9d3c0c4ba5d5f42d1e76a5d009d768fe407e2bcdfa24986236a5b501bf41de8a04c30ebca97c871f822f6c20e508490943dbe0602640770d95f518cce9e7a760 + checksum: 526d529bf995426ace7511f51a425ce92dfc1b6dd74c9956a3cd7d68950119e97291bced2ff17173bcdb329eae36c68abc211a4dec32d6e92ab537b41c0533c2 languageName: node linkType: hard -"@tanstack/react-query@npm:^5.83.0": - version: 5.83.0 - resolution: "@tanstack/react-query@npm:5.83.0" +"@tanstack/react-query@npm:^5.90.2": + version: 5.90.2 + resolution: "@tanstack/react-query@npm:5.90.2" dependencies: - "@tanstack/query-core": "npm:5.83.0" + "@tanstack/query-core": "npm:5.90.2" peerDependencies: react: ^18 || ^19 - checksum: 883229f9219ca906a54d7caafd44d59b57db5dbe87e954f8a7027f460e9f8b97842dfbd0d676dc3111d577baf312c64f6c1fdd67cd1e4b0f0bf574e29670c606 + checksum: 22e76626a59890409858521b0e42b49219126a4ea5ed79eaa48a267959175dfdd28b30b9b03a415dccf703d95c18100a9d8917679818f6d2adc26d6c5f96a4d6 languageName: node linkType: hard @@ -19283,8 +19283,8 @@ __metadata: resolution: "ra-core@workspace:packages/ra-core" dependencies: "@hookform/resolvers": "npm:^3.2.0" - "@tanstack/react-query": "npm:^5.83.0" - "@tanstack/react-query-devtools": "npm:^5.21.7" + "@tanstack/react-query": "npm:^5.90.2" + "@tanstack/react-query-devtools": "npm:^5.90.2" "@testing-library/react": "npm:^15.0.7" "@types/jest": "npm:^29.5.2" "@types/jscodeshift": "npm:^0.11.11" @@ -19527,7 +19527,7 @@ __metadata: version: 0.0.0-use.local resolution: "ra-no-code@workspace:packages/ra-no-code" dependencies: - "@tanstack/react-query": "npm:^5.83.0" + "@tanstack/react-query": "npm:^5.90.2" "@testing-library/react": "npm:^15.0.7" "@testing-library/user-event": "npm:^14.5.2" clsx: "npm:^2.1.1" @@ -19561,7 +19561,7 @@ __metadata: "@mui/material": "npm:^5.16.12" "@mui/system": "npm:^5.16.12" "@mui/utils": "npm:^5.16.12" - "@tanstack/react-query": "npm:^5.83.0" + "@tanstack/react-query": "npm:^5.90.2" "@testing-library/react": "npm:^15.0.7" "@types/dompurify": "npm:^3.0.2" "@types/react": "npm:^18.3.3" @@ -19782,7 +19782,7 @@ __metadata: "@emotion/styled": "npm:^11.14.0" "@mui/icons-material": "npm:^5.16.12 || ^6.0.0 || ^7.0.0" "@mui/material": "npm:^5.16.12 || ^6.0.0 || ^7.0.0" - "@tanstack/react-query": "npm:^5.83.0" + "@tanstack/react-query": "npm:^5.90.2" cross-env: "npm:^5.2.0" expect: "npm:^27.4.6" ra-core: "npm:^5.11.3" @@ -21565,8 +21565,8 @@ __metadata: "@hookform/devtools": "npm:^4.3.3" "@mui/icons-material": "npm:^5.16.12" "@mui/material": "npm:^5.16.12" - "@tanstack/react-query": "npm:^5.83.0" - "@tanstack/react-query-devtools": "npm:^5.83.0" + "@tanstack/react-query": "npm:^5.90.2" + "@tanstack/react-query-devtools": "npm:^5.90.2" "@vitejs/plugin-react": "npm:^4.3.4" fakerest: "npm:^4.1.3" jsonexport: "npm:^3.2.0" From fa895eb578d53a93b092ca00c1db91f0b1ef27b6 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:04:21 +0200 Subject: [PATCH 2/5] Do not bump the dependencies, only devDependencies --- packages/ra-core/package.json | 3 ++- packages/ra-no-code/package.json | 3 ++- packages/ra-ui-materialui/package.json | 3 ++- packages/react-admin/package.json | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/ra-core/package.json b/packages/ra-core/package.json index 45c173bc58e..195a33e5412 100644 --- a/packages/ra-core/package.json +++ b/packages/ra-core/package.json @@ -28,6 +28,7 @@ }, "devDependencies": { "@hookform/resolvers": "^3.2.0", + "@tanstack/react-query": "^5.90.2", "@tanstack/react-query-devtools": "^5.90.2", "@testing-library/react": "^15.0.7", "@types/jest": "^29.5.2", @@ -58,7 +59,7 @@ "react-router-dom": "^6.28.1 || ^7.1.1" }, "dependencies": { - "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query": "^5.83.0", "date-fns": "^3.6.0", "eventemitter3": "^5.0.1", "inflection": "^3.0.0", diff --git a/packages/ra-no-code/package.json b/packages/ra-no-code/package.json index 11968d3b222..7d86726bc84 100644 --- a/packages/ra-no-code/package.json +++ b/packages/ra-no-code/package.json @@ -25,6 +25,7 @@ "watch": "tsc --outDir dist/esm --module es2015 --watch" }, "devDependencies": { + "@tanstack/react-query": "^5.90.2", "@testing-library/react": "^15.0.7", "@testing-library/user-event": "^14.5.2", "cross-env": "^5.2.0", @@ -42,7 +43,7 @@ "react-dom": "^18.0.0 || ^19.0.0" }, "dependencies": { - "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query": "^5.83.0", "clsx": "^2.1.1", "date-fns": "^3.6.0", "inflection": "^3.0.0", diff --git a/packages/ra-ui-materialui/package.json b/packages/ra-ui-materialui/package.json index cbb3c9f9b13..06d2a2c90d2 100644 --- a/packages/ra-ui-materialui/package.json +++ b/packages/ra-ui-materialui/package.json @@ -30,6 +30,7 @@ "@mui/material": "^5.16.12", "@mui/system": "^5.16.12", "@mui/utils": "^5.16.12", + "@tanstack/react-query": "^5.90.2", "@testing-library/react": "^15.0.7", "@types/dompurify": "^3.0.2", "@types/react": "^18.3.3", @@ -68,7 +69,7 @@ "react-router-dom": "^6.28.1 || ^7.1.1" }, "dependencies": { - "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query": "^5.83.0", "autosuggest-highlight": "^3.1.1", "clsx": "^2.1.1", "css-mediaquery": "^0.1.2", diff --git a/packages/react-admin/package.json b/packages/react-admin/package.json index e660aba850c..88765ea74c5 100644 --- a/packages/react-admin/package.json +++ b/packages/react-admin/package.json @@ -25,6 +25,7 @@ "watch": "tsc --outDir dist/esm --module es2015 --watch" }, "devDependencies": { + "@tanstack/react-query": "^5.90.2", "cross-env": "^5.2.0", "expect": "^27.4.6", "react-router": "^6.28.1", @@ -41,7 +42,7 @@ "@emotion/styled": "^11.14.0", "@mui/icons-material": "^5.16.12 || ^6.0.0 || ^7.0.0", "@mui/material": "^5.16.12 || ^6.0.0 || ^7.0.0", - "@tanstack/react-query": "^5.90.2", + "@tanstack/react-query": "^5.83.0", "ra-core": "^5.11.3", "ra-i18n-polyglot": "^5.11.3", "ra-language-english": "^5.11.3", From 1e9f3dbb0d99ce1d297c27655f60f3c5621b546c Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:32:56 +0200 Subject: [PATCH 3/5] Fix useUpdate --- packages/ra-core/src/dataProvider/useUpdate.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ra-core/src/dataProvider/useUpdate.ts b/packages/ra-core/src/dataProvider/useUpdate.ts index b265a4cedc9..60e392c6bc4 100644 --- a/packages/ra-core/src/dataProvider/useUpdate.ts +++ b/packages/ra-core/src/dataProvider/useUpdate.ts @@ -272,7 +272,7 @@ export const useUpdate = ( }, onSuccess: (...args) => { if (mode.current === 'pessimistic') { - const [, variables] = args; + const [data, variables] = args; // update the getOne and getList query cache with the new result const { resource: callTimeResource = resource, From 2201b122a2923b7aaa0797056580fded3ecd92c5 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:33:10 +0200 Subject: [PATCH 4/5] Improve DeleteWithConfirmButton --- .../ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx index bcebde08ab1..bcc03fd0268 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.tsx @@ -96,11 +96,12 @@ export const DeleteWithConfirmButton = ( redirect(redirectTo, resource); } }, - onError: (error, variables, onMutateResult, context) => { + onError: (...args) => { setOpen(false); if (onError) { - onError(error, variables, onMutateResult, context); + onError(...args); } else { + const [error] = args; notify( typeof error === 'string' ? error From 32e4049dfe36d96a45208af86b76a7cb7d1f8475 Mon Sep 17 00:00:00 2001 From: Gildas <1122076+djhi@users.noreply.github.com> Date: Thu, 25 Sep 2025 12:33:14 +0200 Subject: [PATCH 5/5] Fix tests --- .../src/controller/create/CreateBase.spec.tsx | 12 ++++++++---- .../ra-core/src/controller/edit/EditBase.spec.tsx | 12 ++++++++---- .../src/controller/edit/useEditController.spec.tsx | 9 ++++++--- .../src/controller/list/useListController.spec.tsx | 3 +-- packages/ra-core/src/dataProvider/useDelete.spec.tsx | 6 ++++-- .../src/button/DeleteWithConfirmButton.spec.tsx | 6 ++++-- .../src/button/DeleteWithUndoButton.spec.tsx | 3 ++- .../ra-ui-materialui/src/button/SaveButton.spec.tsx | 6 ++++-- .../src/button/UpdateWithConfirmButton.spec.tsx | 6 ++++-- .../src/button/UpdateWithUndoButton.spec.tsx | 3 ++- packages/ra-ui-materialui/src/detail/Edit.spec.tsx | 12 ++++++++---- .../src/input/AutocompleteInput.spec.tsx | 2 ++ .../src/input/SelectArrayInput.spec.tsx | 1 + .../ra-ui-materialui/src/input/SelectInput.spec.tsx | 4 +++- .../ra-ui-materialui/src/input/TextInput.spec.tsx | 3 +++ 15 files changed, 60 insertions(+), 28 deletions(-) diff --git a/packages/ra-core/src/controller/create/CreateBase.spec.tsx b/packages/ra-core/src/controller/create/CreateBase.spec.tsx index 09ac36cbaab..917d59a78d9 100644 --- a/packages/ra-core/src/controller/create/CreateBase.spec.tsx +++ b/packages/ra-core/src/controller/create/CreateBase.spec.tsx @@ -55,7 +55,8 @@ describe('CreateBase', () => { test: 'test', }, { data: { test: 'test' }, resource: 'posts' }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -87,7 +88,8 @@ describe('CreateBase', () => { test: 'test', }, { data: { test: 'test' }, resource: 'posts' }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); expect(onSuccess).not.toHaveBeenCalled(); @@ -114,7 +116,8 @@ describe('CreateBase', () => { expect(onError).toHaveBeenCalledWith( { message: 'test' }, { data: { test: 'test' }, resource: 'posts' }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -141,7 +144,8 @@ describe('CreateBase', () => { expect(onErrorOverride).toHaveBeenCalledWith( { message: 'test' }, { data: { test: 'test' }, resource: 'posts' }, - { snapshot: [] } + expect.anything(), + expect.anything() ); }); expect(onError).not.toHaveBeenCalled(); diff --git a/packages/ra-core/src/controller/edit/EditBase.spec.tsx b/packages/ra-core/src/controller/edit/EditBase.spec.tsx index 8c56b9632d4..d38ecdfa371 100644 --- a/packages/ra-core/src/controller/edit/EditBase.spec.tsx +++ b/packages/ra-core/src/controller/edit/EditBase.spec.tsx @@ -81,7 +81,8 @@ describe('EditBase', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -125,7 +126,8 @@ describe('EditBase', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); expect(onSuccess).not.toHaveBeenCalled(); @@ -162,7 +164,8 @@ describe('EditBase', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -199,7 +202,8 @@ describe('EditBase', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); expect(onError).not.toHaveBeenCalled(); diff --git a/packages/ra-core/src/controller/edit/useEditController.spec.tsx b/packages/ra-core/src/controller/edit/useEditController.spec.tsx index 103033c97dd..311b6981b5e 100644 --- a/packages/ra-core/src/controller/edit/useEditController.spec.tsx +++ b/packages/ra-core/src/controller/edit/useEditController.spec.tsx @@ -459,7 +459,8 @@ describe('useEditController', () => { resource: 'posts', meta: undefined, }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ) ); expect(notificationsSpy).toEqual([]); @@ -513,7 +514,8 @@ describe('useEditController', () => { resource: 'posts', meta: undefined, }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ) ); expect(notificationsSpy).toEqual([]); @@ -566,7 +568,8 @@ describe('useEditController', () => { resource: 'posts', meta: undefined, }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ) ); expect(notificationsSpy).toEqual([]); diff --git a/packages/ra-core/src/controller/list/useListController.spec.tsx b/packages/ra-core/src/controller/list/useListController.spec.tsx index 40ffa45d15d..a15f5c87a58 100644 --- a/packages/ra-core/src/controller/list/useListController.spec.tsx +++ b/packages/ra-core/src/controller/list/useListController.spec.tsx @@ -240,7 +240,6 @@ describe('useListController', () => { ); // Check that the permanent filter is not included in the displayedFilters and filterValues (passed to Filter form and button) - expect(children).toHaveBeenCalledTimes(2); expect(children).toHaveBeenCalledWith( expect.objectContaining({ displayedFilters: {}, @@ -264,7 +263,7 @@ describe('useListController', () => { 'posts', expect.objectContaining({ filter: { foo: 2 } }) ); - expect(children).toHaveBeenCalledTimes(4); + expect(children).toHaveBeenCalledTimes(3); }); }); diff --git a/packages/ra-core/src/dataProvider/useDelete.spec.tsx b/packages/ra-core/src/dataProvider/useDelete.spec.tsx index 3e07f66091f..164f2f5472c 100644 --- a/packages/ra-core/src/dataProvider/useDelete.spec.tsx +++ b/packages/ra-core/src/dataProvider/useDelete.spec.tsx @@ -336,7 +336,8 @@ describe('useDelete', () => { expect(onSuccess).toHaveBeenCalledWith( { id: 1 }, { id: 1, previousData: { foo: 456 }, resource: 'foo' }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -372,7 +373,8 @@ describe('useDelete', () => { expect(onError).toHaveBeenCalledWith( new Error('not good'), { id: 1, previousData: { foo: 456 }, resource: 'foo' }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.spec.tsx b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.spec.tsx index 80a1401b736..d4cd250adce 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.spec.tsx +++ b/packages/ra-ui-materialui/src/button/DeleteWithConfirmButton.spec.tsx @@ -223,7 +223,8 @@ describe('', () => { previousData: { id: 123, title: 'lorem' }, resource: 'posts', }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); await waitFor(() => { @@ -276,7 +277,8 @@ describe('', () => { previousData: { id: 123, title: 'lorem' }, resource: 'posts', }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); await waitFor(() => { diff --git a/packages/ra-ui-materialui/src/button/DeleteWithUndoButton.spec.tsx b/packages/ra-ui-materialui/src/button/DeleteWithUndoButton.spec.tsx index 845df8f5ef1..38d414fc6ac 100644 --- a/packages/ra-ui-materialui/src/button/DeleteWithUndoButton.spec.tsx +++ b/packages/ra-ui-materialui/src/button/DeleteWithUndoButton.spec.tsx @@ -107,7 +107,8 @@ describe('', () => { previousData: { id: 123, title: 'lorem' }, resource: 'posts', }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/button/SaveButton.spec.tsx b/packages/ra-ui-materialui/src/button/SaveButton.spec.tsx index 410cff37d48..5f5d577ca1b 100644 --- a/packages/ra-ui-materialui/src/button/SaveButton.spec.tsx +++ b/packages/ra-ui-materialui/src/button/SaveButton.spec.tsx @@ -177,7 +177,8 @@ describe('', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -230,7 +231,8 @@ describe('', () => { resource: 'posts', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/button/UpdateWithConfirmButton.spec.tsx b/packages/ra-ui-materialui/src/button/UpdateWithConfirmButton.spec.tsx index f1741f621fa..ef97d3f062f 100644 --- a/packages/ra-ui-materialui/src/button/UpdateWithConfirmButton.spec.tsx +++ b/packages/ra-ui-materialui/src/button/UpdateWithConfirmButton.spec.tsx @@ -207,7 +207,8 @@ describe('', () => { meta: undefined, resource: 'posts', }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ); }); }); @@ -261,7 +262,8 @@ describe('', () => { meta: undefined, resource: 'posts', }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/button/UpdateWithUndoButton.spec.tsx b/packages/ra-ui-materialui/src/button/UpdateWithUndoButton.spec.tsx index a20b08df405..a4e7f215bf9 100644 --- a/packages/ra-ui-materialui/src/button/UpdateWithUndoButton.spec.tsx +++ b/packages/ra-ui-materialui/src/button/UpdateWithUndoButton.spec.tsx @@ -101,7 +101,8 @@ describe('', () => { previousData: { id: 123, title: 'lorem', views: 500 }, resource: 'posts', }, - { snapshot: expect.any(Array) } + { snapshot: expect.any(Array) }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/detail/Edit.spec.tsx b/packages/ra-ui-materialui/src/detail/Edit.spec.tsx index 9d92fffa0d4..66ceab88f4a 100644 --- a/packages/ra-ui-materialui/src/detail/Edit.spec.tsx +++ b/packages/ra-ui-materialui/src/detail/Edit.spec.tsx @@ -402,7 +402,8 @@ describe('', () => { resource: 'foo', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -467,7 +468,8 @@ describe('', () => { resource: 'foo', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); expect(onSuccess).not.toHaveBeenCalled(); }); @@ -526,7 +528,8 @@ describe('', () => { resource: 'foo', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); @@ -591,7 +594,8 @@ describe('', () => { resource: 'foo', meta: undefined, }, - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); expect(onError).not.toHaveBeenCalled(); }); diff --git a/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx b/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx index e352ebb2b88..8a09a15c85c 100644 --- a/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/AutocompleteInput.spec.tsx @@ -1605,6 +1605,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( expect.objectContaining({ author: null }), expect.anything(), + expect.anything(), expect.anything() ); }); @@ -1737,6 +1738,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( expect.objectContaining({ author: undefined }), expect.anything(), + expect.anything(), expect.anything() ); }); diff --git a/packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx b/packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx index 9ce406f1cb6..1d8a58c000d 100644 --- a/packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/SelectArrayInput.spec.tsx @@ -804,6 +804,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( expect.objectContaining({ authors: undefined }), expect.anything(), + expect.anything(), expect.anything() ); }); diff --git a/packages/ra-ui-materialui/src/input/SelectInput.spec.tsx b/packages/ra-ui-materialui/src/input/SelectInput.spec.tsx index f3d24d34ba0..18be67ddb93 100644 --- a/packages/ra-ui-materialui/src/input/SelectInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/SelectInput.spec.tsx @@ -929,6 +929,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( expect.objectContaining({ author: undefined }), expect.anything(), + expect.anything(), expect.anything() ); }); @@ -947,7 +948,8 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( expect.objectContaining({ gender: null }), expect.anything(), - { snapshot: [] } + { snapshot: [] }, + expect.anything() ); }); }); diff --git a/packages/ra-ui-materialui/src/input/TextInput.spec.tsx b/packages/ra-ui-materialui/src/input/TextInput.spec.tsx index b63c605b716..4b00302573e 100644 --- a/packages/ra-ui-materialui/src/input/TextInput.spec.tsx +++ b/packages/ra-ui-materialui/src/input/TextInput.spec.tsx @@ -137,6 +137,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( { id: 123, title: null }, expect.anything(), + expect.anything(), expect.anything() ); }); @@ -148,6 +149,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( { id: 123, title: 'test' }, expect.anything(), + expect.anything(), expect.anything() ); }); @@ -159,6 +161,7 @@ describe('', () => { expect(onSuccess).toHaveBeenCalledWith( { id: 123, title: null }, expect.anything(), + expect.anything(), expect.anything() ); });