diff --git a/src/CreateGuesser.tsx b/src/CreateGuesser.tsx index ceaa36ca..3ac76cf2 100644 --- a/src/CreateGuesser.tsx +++ b/src/CreateGuesser.tsx @@ -99,7 +99,8 @@ export const IntrospectedCreateGuesser = ({ const response = await create( resource, { - data: { ...data, extraInformation: { hasFileField } }, + data, + meta: { hasFileField }, }, { returnPromise: true }, ); diff --git a/src/EditGuesser.tsx b/src/EditGuesser.tsx index 992d8e16..2159e448 100644 --- a/src/EditGuesser.tsx +++ b/src/EditGuesser.tsx @@ -123,7 +123,8 @@ export const IntrospectedEditGuesser = ({ resource, { id, - data: { ...data, extraInformation: { hasFileField } }, + data, + meta: { hasFileField }, }, { returnPromise: true }, ); @@ -200,10 +201,6 @@ export const IntrospectedEditGuesser = ({ mutationMode={mutationMode} redirect={redirectTo} component={viewComponent} - transform={(data: Partial) => ({ - ...data, - extraInformation: { hasFileField }, - })} {...props}> { data: { bar: 'baz', foo: 'foo', - extraInformation: { - hasFileField: true, - }, + }, + meta: { + hasFileField: true, }, }); const url = mockFetchHydra.mock.calls?.[0]?.[0] ?? new URL('https://foo'); @@ -360,9 +360,9 @@ describe('Transform a React Admin request to an Hydra request', () => { foo: 'foo', bar: 'baz', qux: null, - extraInformation: { - hasFileField: true, - }, + }, + meta: { + hasFileField: true, }, previousData: { id: '/entrypoint/resource/1', diff --git a/src/hydra/dataProvider.ts b/src/hydra/dataProvider.ts index 3ece47db..55479610 100644 --- a/src/hydra/dataProvider.ts +++ b/src/hydra/dataProvider.ts @@ -351,9 +351,8 @@ function dataProvider( } }); let extraInformation: { hasFileField?: boolean } = {}; - if ('data' in params && params.data.extraInformation) { - extraInformation = params.data.extraInformation; - delete params.data.extraInformation; + if ('meta' in params) { + extraInformation = params.meta; } const updateHttpMethod = extraInformation.hasFileField ? 'POST' : 'PUT';