File tree 4 files changed +16
-9
lines changed
4 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -61,8 +61,6 @@ function ExpandedRow(props: ExpandedRowProps) {
61
61
className = { className }
62
62
style = { {
63
63
display : expanded ? null : 'none' ,
64
- // fix https://github.com/ant-design/ant-design/issues/49279
65
- visibility : isEmpty && horizonScroll && ! componentWidth ? 'hidden' : null ,
66
64
} }
67
65
>
68
66
< Cell component = { cellComponent } prefixCls = { prefixCls } colSpan = { colSpan } >
Original file line number Diff line number Diff line change @@ -495,9 +495,9 @@ function Table<RecordType extends DefaultRecordType>(
495
495
}
496
496
} ;
497
497
498
- const onFullTableResize = ( { width } ) => {
498
+ const onFullTableResize = ( offsetWidth ?: number ) => {
499
499
stickyRef . current ?. checkScrollBarVisible ( ) ;
500
- let mergedWidth = fullTableRef . current ? fullTableRef . current . offsetWidth : width ;
500
+ let mergedWidth = offsetWidth ?? fullTableRef . current ? .offsetWidth ?? 0 ;
501
501
if ( useInternalHooks && getContainerWidth && fullTableRef . current ) {
502
502
mergedWidth = getContainerWidth ( fullTableRef . current , mergedWidth ) || mergedWidth ;
503
503
}
@@ -508,6 +508,13 @@ function Table<RecordType extends DefaultRecordType>(
508
508
}
509
509
} ;
510
510
511
+ // fix https://github.com/ant-design/ant-design/issues/49279
512
+ useLayoutEffect ( ( ) => {
513
+ if ( horizonScroll ) {
514
+ onFullTableResize ( ) ;
515
+ }
516
+ } , [ horizonScroll ] ) ;
517
+
511
518
// Sync scroll bar when init or `horizonScroll`, `data` and `columns.length` changed
512
519
const mounted = React . useRef ( false ) ;
513
520
React . useEffect ( ( ) => {
@@ -799,7 +806,11 @@ function Table<RecordType extends DefaultRecordType>(
799
806
) ;
800
807
801
808
if ( horizonScroll ) {
802
- fullTable = < ResizeObserver onResize = { onFullTableResize } > { fullTable } </ ResizeObserver > ;
809
+ fullTable = (
810
+ < ResizeObserver onResize = { ( { offsetWidth } ) => onFullTableResize ( offsetWidth ) } >
811
+ { fullTable }
812
+ </ ResizeObserver >
813
+ ) ;
803
814
}
804
815
805
816
const fixedInfoList = useFixedInfo ( flattenColumns , stickyOffsets ) ;
Original file line number Diff line number Diff line change @@ -569,7 +569,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
569
569
>
570
570
<div
571
571
class = " rc-table-expanded-row-fixed"
572
- style = " width: 0px ; position: sticky; left: 0px; overflow: hidden;"
572
+ style = " width: 1128px ; position: sticky; left: 0px; overflow: hidden;"
573
573
>
574
574
<p >
575
575
extra data
@@ -616,7 +616,7 @@ exports[`Table.Expand > renders fixed column correctly > work 1`] = `
616
616
>
617
617
<div
618
618
class = " rc-table-expanded-row-fixed"
619
- style = " width: 0px ; position: sticky; left: 0px; overflow: hidden;"
619
+ style = " width: 1128px ; position: sticky; left: 0px; overflow: hidden;"
620
620
>
621
621
<p >
622
622
extra data
Original file line number Diff line number Diff line change @@ -1819,7 +1819,6 @@ exports[`Table.FixedColumn > renders correctly > scrollX - without data 1`] = `
1819
1819
</tr >
1820
1820
<tr
1821
1821
class = " rc-table-placeholder"
1822
- style = " "
1823
1822
>
1824
1823
<td
1825
1824
class = " rc-table-cell"
@@ -2976,7 +2975,6 @@ exports[`Table.FixedColumn > renders correctly > scrollXY - without data 1`] = `
2976
2975
</tr >
2977
2976
<tr
2978
2977
class = " rc-table-placeholder"
2979
- style = " "
2980
2978
>
2981
2979
<td
2982
2980
class = " rc-table-cell"
You can’t perform that action at this time.
0 commit comments