From 80d466e81aefdadc680cccbd708966231e25de3e Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 22 Aug 2024 18:06:27 +0800 Subject: [PATCH] fix: issue where data couldn't be submitted after deleting a row with required field in the subform (#5101) --- .../src/schema-component/antd/association-field/Nester.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/core/client/src/schema-component/antd/association-field/Nester.tsx b/packages/core/client/src/schema-component/antd/association-field/Nester.tsx index d4e8236d3d..74bbe756ab 100644 --- a/packages/core/client/src/schema-component/antd/association-field/Nester.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/Nester.tsx @@ -15,6 +15,7 @@ import { action } from '@formily/reactive'; import { each } from '@formily/shared'; import { Button, Card, Divider, Tooltip } from 'antd'; import React, { useCallback, useContext } from 'react'; +import { spliceArrayState } from '@formily/core/esm/shared/internals'; import { useTranslation } from 'react-i18next'; import { FormActiveFieldsProvider } from '../../../block-provider/hooks/useFormActiveFields'; import { useCollection } from '../../../data-source'; @@ -186,6 +187,10 @@ const ToManyNester = observer( style={{ zIndex: 1000, color: '#a8a3a3' }} onClick={() => { action(() => { + spliceArrayState(field as any, { + startIndex: index, + deleteCount: 1, + }); field.value.splice(index, 1); return field.onInput(field.value); });