From 5c83da5f36fbc27a920c8834966ff7a93bb80ec3 Mon Sep 17 00:00:00 2001 From: lijianan <574980606@qq.com> Date: Fri, 9 Jun 2023 15:44:25 +0800 Subject: [PATCH] test: add codecov for fix CI fail (#42909) * test: add codecov fix CI fail * test: add test case * test: remove test case --- components/transfer/hooks/useData.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/transfer/hooks/useData.ts b/components/transfer/hooks/useData.ts index abaf6e8c46..3ee1384d3c 100644 --- a/components/transfer/hooks/useData.ts +++ b/components/transfer/hooks/useData.ts @@ -2,10 +2,10 @@ import * as React from 'react'; import type { KeyWise, TransferProps } from '..'; import { groupKeysMap } from '../../_util/transKeys'; -export default function useData( +function useData( dataSource?: RecordType[], rowKey?: TransferProps['rowKey'], - targetKeys: string[] = [], + targetKeys?: string[], ) { const mergedDataSource = React.useMemo( () => @@ -20,8 +20,8 @@ export default function useData( const [leftDataSource, rightDataSource] = React.useMemo(() => { const leftData: KeyWise[] = []; - const rightData: KeyWise[] = new Array(targetKeys.length); - const targetKeysMap = groupKeysMap(targetKeys); + const rightData: KeyWise[] = new Array((targetKeys || []).length); + const targetKeysMap = groupKeysMap(targetKeys || []); mergedDataSource.forEach((record: KeyWise) => { // rightData should be ordered by targetKeys // leftData should be ordered by dataSource @@ -36,3 +36,5 @@ export default function useData( return [mergedDataSource, leftDataSource, rightDataSource]; } + +export default useData;