fix: avoid errors

This commit is contained in:
Rairn 2023-04-24 15:21:31 +08:00
parent fbe73d1e80
commit d79af627ec

View File

@ -159,7 +159,7 @@ export const InputRecordPicker: React.FC<any> = (props: IRecordPickerProps) => {
multiple={multiple} multiple={multiple}
quickUpload={quickUpload} quickUpload={quickUpload}
selectFile={selectFile} selectFile={selectFile}
action={`${collectionField.target}:create`} action={`${collectionField?.target}:create`}
onSelect={handleSelect} onSelect={handleSelect}
onRemove={handleRemove} onRemove={handleRemove}
onChange={(changed) => { onChange={(changed) => {
@ -237,7 +237,7 @@ const Drawer: React.FunctionComponent<{
options, options,
}) => { }) => {
const getFilter = () => { const getFilter = () => {
const targetKey = collectionField.targetKey || 'id'; const targetKey = collectionField?.targetKey || 'id';
const list = options.map((option) => option[targetKey]).filter(Boolean); const list = options.map((option) => option[targetKey]).filter(Boolean);
const filter = list.length ? { $and: [{ [`${targetKey}.$ne`]: list }] } : {}; const filter = list.length ? { $and: [{ [`${targetKey}.$ne`]: list }] } : {};
return filter; return filter;