mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-17 16:45:02 +00:00
fix: multiple select value type when empty string does not have map function (#5487)
This commit is contained in:
@@ -21,6 +21,7 @@ import { useTranslation } from 'next-i18next';
|
|||||||
import type { useScrollPagination } from '../../../hooks/useScrollPagination';
|
import type { useScrollPagination } from '../../../hooks/useScrollPagination';
|
||||||
import MyDivider from '../MyDivider';
|
import MyDivider from '../MyDivider';
|
||||||
import { shadowLight } from '../../../styles/theme';
|
import { shadowLight } from '../../../styles/theme';
|
||||||
|
import { isArray } from 'lodash';
|
||||||
|
|
||||||
const menuItemStyles: MenuItemProps = {
|
const menuItemStyles: MenuItemProps = {
|
||||||
borderRadius: 'sm',
|
borderRadius: 'sm',
|
||||||
@@ -100,6 +101,7 @@ const MultipleSelect = <T = any,>({
|
|||||||
const [overflowItems, setOverflowItems] = useState<SelectedItemType[]>([]);
|
const [overflowItems, setOverflowItems] = useState<SelectedItemType[]>([]);
|
||||||
|
|
||||||
const selectedItems = useMemo(() => {
|
const selectedItems = useMemo(() => {
|
||||||
|
if (!value || !isArray(value)) return [];
|
||||||
return value.map((val) => {
|
return value.map((val) => {
|
||||||
const listItem = list.find((item) => item.value === val);
|
const listItem = list.find((item) => item.value === val);
|
||||||
return listItem || { value: val, label: String(val) };
|
return listItem || { value: val, label: String(val) };
|
||||||
|
Reference in New Issue
Block a user