From 2061f702a867b25ad3ff497dc968151ee7ff5238 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 17 Oct 2024 12:01:41 +0800 Subject: [PATCH] fix: data clearing bug when selecting association data with data scope in nested sub-table (#5441) --- .../antd/association-field/AssociationSelect.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx b/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx index 4097ce0591..65611d78cb 100644 --- a/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/AssociationSelect.tsx @@ -13,6 +13,7 @@ import { RecursionField, connect, mapProps, observer, useField, useFieldSchema, import { uid } from '@formily/shared'; import { Space, message } from 'antd'; import { isFunction } from 'mathjs'; +import { last } from 'lodash'; import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { ClearCollectionFieldContext, RecordProvider, useAPIClient, useCollectionRecordData } from '../../../'; @@ -82,7 +83,7 @@ const InternalAssociationSelect = observer( if ( linkageFields.includes(fieldPath?.props?.name) && field.value && - fieldPath?.indexes?.[0] === field?.indexes?.[0] && + last(fieldPath?.indexes) === last(field?.indexes) && fieldPath?.props?.name !== field.props.name ) { field.setValue(undefined);