File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -443,7 +443,7 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
443443
444444 const onFullTableResize = ( { width } ) => {
445445 let mergedWidth = fullTableRef . current ? fullTableRef . current . offsetWidth : width ;
446- if ( useInternalHooks && getContainerWidth ) {
446+ if ( useInternalHooks && getContainerWidth && fullTableRef . current ) {
447447 mergedWidth = getContainerWidth ( fullTableRef . current , mergedWidth ) || mergedWidth ;
448448 }
449449
@@ -669,7 +669,7 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
669669 </ FixedHolder >
670670 ) }
671671
672- { isSticky && scrollBodyRef . current instanceof Element && (
672+ { isSticky && scrollBodyRef . current && scrollBodyRef . current instanceof Element && (
673673 < StickyScrollBar
674674 ref = { stickyRef }
675675 offsetScroll = { offsetScroll }
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+ import { renderToString } from 'react-dom/server' ;
3+ import Table from '../src' ;
4+
5+ describe ( 'Table.Node' , ( ) => {
6+ // Remove env variables
7+ window . Element = null ;
8+ global . Element = null ;
9+
10+ it ( 'not crash in node' , ( ) => {
11+ console . log ( Element ) ;
12+
13+ const html = renderToString (
14+ < Table
15+ columns = { [ { title : 'Name' , dataIndex : 'name' , key : 'name' } ] }
16+ data = { [ { key : 'key0' , name : 'Lucy' } ] }
17+ sticky
18+ /> ,
19+ ) ;
20+
21+ expect ( html ) . toContain ( 'rc-table' ) ;
22+ } ) ;
23+ } ) ;
You can’t perform that action at this time.
0 commit comments