From 346a9ff322ac37d5c2acd7deea4f367272ede09a Mon Sep 17 00:00:00 2001 From: Uyarn Date: Fri, 10 May 2024 19:13:27 +0800 Subject: [PATCH] fix(table): fix table crash when rootThWidthList is empty object --- src/table/hooks/useFixed.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/table/hooks/useFixed.ts b/src/table/hooks/useFixed.ts index 0b152dcf1..77ca5ed0c 100644 --- a/src/table/hooks/useFixed.ts +++ b/src/table/hooks/useFixed.ts @@ -452,6 +452,7 @@ export default function useFixed( reduceWidth += thWidthList[key]; }); const rootThWidthList = pick(thWidthList, preColKeys); + if (!Object.values(rootThWidthList).length) return; const oldTotalWidth = Object.values(rootThWidthList).reduce((r = 0, n) => r + n); // 保留原有可能编辑过的列宽度,但是当剩余列过小时,表头小于内容宽,需要缩放回内容宽度 // 使用不包含滚动条的可视化区域宽度,意味着当不再溢出的时候,将宽度设置回完整宽度