fix(client): fix some warnings (#4143)

This commit is contained in:
Junyi 2024-04-23 21:12:37 +08:00 committed by GitHub
parent 90144e32ce
commit b0ba197915
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -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,
);
}),
});
}

View File

@ -13,6 +13,7 @@ import { RemoteSelect, RemoteSelectProps } from '../remote-select';
import useServiceOptions, { useAssociationFieldContext } from './hooks';
export type AssociationSelectProps<P = any> = RemoteSelectProps<P> & {
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(
<Space.Compact style={{ display: 'flex', lineHeight: '32px' }}>
<RemoteSelect
style={{ width: '100%' }}
{...props}
{...rest}
size={'middle'}
objectValue={objectValue}
value={value || innerValue}