diff --git a/package.json b/package.json index 7a5c7151a..7be16fb27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rc-table", - "version": "7.34.3", + "version": "7.34.4", "description": "table ui component for react", "engines": { "node": ">=8.x" diff --git a/src/Table.tsx b/src/Table.tsx index 28f3b86d2..a52901bd0 100644 --- a/src/Table.tsx +++ b/src/Table.tsx @@ -443,7 +443,7 @@ function Table(tableProps: TableProps { let mergedWidth = fullTableRef.current ? fullTableRef.current.offsetWidth : width; - if (useInternalHooks && getContainerWidth) { + if (useInternalHooks && getContainerWidth && fullTableRef.current) { mergedWidth = getContainerWidth(fullTableRef.current, mergedWidth) || mergedWidth; } @@ -669,7 +669,7 @@ function Table(tableProps: TableProps )} - {isSticky && scrollBodyRef.current instanceof Element && ( + {isSticky && scrollBodyRef.current && scrollBodyRef.current instanceof Element && ( { + // Remove env variables + window.Element = null; + global.Element = null; + + it('not crash in node', () => { + console.log(Element); + + const html = renderToString( + , + ); + + expect(html).toContain('rc-table'); + }); +});