refactor: m2m data filtering through collection data (#2497)
This commit is contained in:
parent
ccf8b651ff
commit
0532d67e0b
@ -89,7 +89,10 @@ export const FormItem: any = observer(
|
|||||||
let iniValues = [];
|
let iniValues = [];
|
||||||
contextData?.map((v) => {
|
contextData?.map((v) => {
|
||||||
const data = parseVariables(schema.default, { $context: v });
|
const data = parseVariables(schema.default, { $context: v });
|
||||||
iniValues = iniValues.concat(data);
|
iniValues = iniValues.concat(data).map((v) => {
|
||||||
|
delete v[collectionField.through];
|
||||||
|
return v;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
const data = _.uniqBy(iniValues, 'id');
|
const data = _.uniqBy(iniValues, 'id');
|
||||||
field.setInitialValue?.(data.length > 0 ? data : [{}]);
|
field.setInitialValue?.(data.length > 0 ? data : [{}]);
|
||||||
|
Loading…
Reference in New Issue
Block a user