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
443
443
444
444
const onFullTableResize = ( { width } ) => {
445
445
let mergedWidth = fullTableRef . current ? fullTableRef . current . offsetWidth : width ;
446
- if ( useInternalHooks && getContainerWidth ) {
446
+ if ( useInternalHooks && getContainerWidth && fullTableRef . current ) {
447
447
mergedWidth = getContainerWidth ( fullTableRef . current , mergedWidth ) || mergedWidth ;
448
448
}
449
449
@@ -669,7 +669,7 @@ function Table<RecordType extends DefaultRecordType>(tableProps: TableProps<Reco
669
669
</ FixedHolder >
670
670
) }
671
671
672
- { isSticky && scrollBodyRef . current instanceof Element && (
672
+ { isSticky && scrollBodyRef . current && scrollBodyRef . current instanceof Element && (
673
673
< StickyScrollBar
674
674
ref = { stickyRef }
675
675
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