Closed 7system7 closed 4 months ago
Can you dump content of params
?
https://github.com/api-platform/admin/blob/0d173f58ac74fbdbff4ebc16bfb5b0539ca33236/src/hydra/dataProvider.ts#L355
It seems that it should be declared in this way (?):
const extraInformation: { hasFileField?: boolean } = params.meta ?? {};
Sure.
{
"id": "/api/deals/7631"
"meta": undefined
"data": {
// very long object
},
"previousData": {
// very long object
}
}
And I think, you are right w/ this part: params?.meta ?? {}
Yes, I can confirm that, if I change this line, the problem seems solved.
Thanks. While waiting for fixed version passing empty object as meta prop should make it work without downgrade.
meta prop should make it work without downgrade.
Sadly, (if I try it well) it does not work here
const [create] = useCreate(undefined, undefined, {
meta: {},
onSuccess: data => {
// do sg
},
});
nor here :disappointed:
create('partner_accounts', {
data: {
// big object
},
}, { meta: {} });
Meanwhile the forms are OK, w/ this workarond
<Edit mutationOptions={{ meta: {} }}>
meta prop should make it work Meanwhile the forms are OK, w/ this workarond
<Edit mutationOptions={{ meta: {} }}>
Yes, this is what I wrote about.
Btw, I found another workaround. I replace the file w/ the webpack Encore. I added this line to the config and changed that line you mentioned. (Actually I copied the lines from the PR.)
const webpack = require('webpack');
Encore
.addPlugin(
new webpack.NormalModuleReplacementPlugin(
/@api-platform\/admin\/lib\/hydra\/dataProvider.js/,
'../../../../../assets/js/moduleOverrides/dataProvider.js',
),
)
;
Btw, I found another workaround...
pnpm patch
is also a nice tool and first of all useOnSubmit()
hook should work if AP on submit logic is enough here.
Is there any permanent solution to this problem? I experience the same thing.
i just use data provider directly with ra admin.
i meantime i solved it with following code change:
if (
!extraInformation**?**.hasFileField &&
!values.some((value) => containFile(value))
) {
return JSON.stringify(hydraData);
}
Waiting for a release... In meantime need to inline the dp I guess?
API Platform version(s) affected: 3.2
Description
I got
TypeError: extraInformation is undefined
for every built-in queries that modifies something. (i.e. POST, PUT)How to reproduce
If I have these versions:
And you create a request i.e.
I got this error:
Possible Solution
Downgrade (?)
Additional Context
Before this, I got these versions w/o any error...