From 3e8a80a3ae629976a794e7f4c17afab830cd6a0e Mon Sep 17 00:00:00 2001 From: Junyi Date: Tue, 28 Jun 2022 10:08:24 +0800 Subject: [PATCH] fix(client): change toArr to _.castArray in select component (#543) --- .../core/client/src/schema-component/antd/select/shared.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/select/shared.ts b/packages/core/client/src/schema-component/antd/select/shared.ts index 6202fde71c..57c828f2d5 100644 --- a/packages/core/client/src/schema-component/antd/select/shared.ts +++ b/packages/core/client/src/schema-component/antd/select/shared.ts @@ -1,4 +1,4 @@ -import { toArr } from '@formily/shared'; +import { castArray } from 'lodash'; export const defaultFieldNames = { label: 'label', @@ -8,7 +8,9 @@ export const defaultFieldNames = { }; export const getCurrentOptions = (values, dataSource, fieldNames) => { - values = toArr(values).map((val) => (typeof val === 'object' ? val[fieldNames.value] : val)); + values = castArray(values) + .filter(item => item != null) + .map((val) => (typeof val === 'object' ? val[fieldNames.value] : val)); const findOptions = (options: any[]) => { let current = []; for (const option of options) {