Skip to content

Commit 048ace7

Browse files
authored
Prevent resize infinite loop in TableView when scrollbars are always on (#4846)
* rough solution * simplify to array and include it in the pre-existing state * alternative placement * making table column header match body width with subpixel precision clientWidth was rounding the width value of the body and setting that as the visible rect. This meant that the column header row was sometimes set a bit too wide due to the rounding up, thus causing scrollbars to appear when the table matches its flex container width. These scrollbars cause the infinite calc loop in the issue * fix a bunch of tests * fix remaining tests * fix lint * handle SSR computedStyle doesnt work in SSR, fallback to 0 * reverting test changes and fixing crash by removing set width on head wrapper it seems we may not need the width on the head wrapper since overflow:hidden on the head wrapper sets its min-width:auto to compute to 0, making the headwrapper not affect the computed width of the wrapping flex container regardless if it has a ton of columns * fix lint
1 parent da96e87 commit 048ace7

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

packages/@react-spectrum/table/src/TableViewBase.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ function TableVirtualizer(props) {
612612
}, [state.contentSize, headerRef, bodyRef, domRef]);
613613

614614
let headerHeight = layout.getLayoutInfo('header')?.rect.height || 0;
615-
let visibleRect = state.virtualizer.visibleRect;
616615

617616
// Sync the scroll position from the table body to the header container.
618617
let onScroll = useCallback(() => {
@@ -649,7 +648,6 @@ function TableVirtualizer(props) {
649648
role="presentation"
650649
className={classNames(styles, 'spectrum-Table-headWrapper')}
651650
style={{
652-
width: visibleRect.width,
653651
height: headerHeight,
654652
overflow: 'hidden',
655653
position: 'relative',

0 commit comments

Comments
 (0)