From c3129663ebc573f7dff464eb65cbc36f8500a457 Mon Sep 17 00:00:00 2001 From: Netfan Date: Wed, 15 Jan 2025 20:11:32 +0800 Subject: [PATCH] fix: form update state error before form mounted (#5406) --- packages/@core/ui-kit/form-ui/src/form-api.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/@core/ui-kit/form-ui/src/form-api.ts b/packages/@core/ui-kit/form-ui/src/form-api.ts index 2d1e971ab..c3d7b2bbe 100644 --- a/packages/@core/ui-kit/form-ui/src/form-api.ts +++ b/packages/@core/ui-kit/form-ui/src/form-api.ts @@ -404,9 +404,8 @@ export class FormApi { const deletedSchema = prevSchema.filter( (item) => !currentFields.has(item.fieldName), ); - for (const schema of deletedSchema) { - this.form?.setFieldValue(schema.fieldName, undefined); + this.form?.setFieldValue?.(schema.fieldName, undefined); } } }