diff --git a/packages/antd/src/array-collapse/index.tsx b/packages/antd/src/array-collapse/index.tsx index 8183ca85afa..dbdce4adda4 100644 --- a/packages/antd/src/array-collapse/index.tsx +++ b/packages/antd/src/array-collapse/index.tsx @@ -81,8 +81,10 @@ export const ArrayCollapse: ComposedArrayCollapse = observer( ) } - const [activeKeys, setActiveKeys] = useState>( - Array.from({ length: props?.defaultOpenPanelCount || 1 }).map((_, i) => i) + const [activeKeys, setActiveKeys] = useState>( + Array.from({ length: props?.defaultOpenPanelCount || 1 }).map((_, i) => + String(i) + ) ) const renderItems = () => { @@ -177,7 +179,13 @@ export const ArrayCollapse: ComposedArrayCollapse = observer( ) } return ( - setActiveKeys(activeKeys.concat(index))}> + { + if (!activeKeys.includes(String(index))) { + setActiveKeys(activeKeys.concat(String(index))) + } + }} + > {renderEmpty()} {renderItems()} {renderAddition()}