From b0ba197915106b70809b5fd742335aa15db92219 Mon Sep 17 00:00:00 2001 From: Junyi Date: Tue, 23 Apr 2024 21:12:37 +0800 Subject: [PATCH] fix(client): fix some warnings (#4143) --- packages/core/client/src/api-client/APIClient.ts | 8 ++++++-- .../antd/association-field/AssociationSelect.tsx | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/api-client/APIClient.ts b/packages/core/client/src/api-client/APIClient.ts index 9c8ff70cd1..f4a232f717 100644 --- a/packages/core/client/src/api-client/APIClient.ts +++ b/packages/core/client/src/api-client/APIClient.ts @@ -9,8 +9,12 @@ function notify(type, messages, instance) { return; } instance[type]({ - message: messages.map?.((item: any) => { - return React.createElement('div', {}, typeof item === 'string' ? item : item.message); + message: messages.map?.((item: any, index) => { + return React.createElement( + 'div', + { key: `${index}_${item.message}` }, + typeof item === 'string' ? item : item.message, + ); }), }); } 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 68badafc25..ff27b42a64 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 { RemoteSelect, RemoteSelectProps } from '../remote-select'; import useServiceOptions, { useAssociationFieldContext } from './hooks'; export type AssociationSelectProps

= RemoteSelectProps

& { + addMode?: 'quickAdd' | 'modalAdd'; action?: string; multiple?: boolean; }; @@ -42,7 +43,7 @@ export const filterAnalyses = (filters): any[] => { const InternalAssociationSelect = observer( (props: AssociationSelectProps) => { - const { objectValue = true } = props; + const { objectValue = true, addMode: propsAddMode, ...rest } = props; const field: any = useField(); const fieldSchema = useFieldSchema(); const service = useServiceOptions(props); @@ -120,7 +121,7 @@ const InternalAssociationSelect = observer(