From 0532d67e0bc59da4a0391ac98cf1f078f07f03d6 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 21 Aug 2023 22:08:37 +0800 Subject: [PATCH] refactor: m2m data filtering through collection data (#2497) --- .../client/src/schema-component/antd/form-item/FormItem.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx index a481f007a..6d9233158 100644 --- a/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx +++ b/packages/core/client/src/schema-component/antd/form-item/FormItem.tsx @@ -89,7 +89,10 @@ export const FormItem: any = observer( let iniValues = []; contextData?.map((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'); field.setInitialValue?.(data.length > 0 ? data : [{}]);