Skip to content

Commit 3db471a

Browse files
authored
Update List.tsx to use less renders
1 parent fa89a0c commit 3db471a

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/components/List.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,9 @@ function BaseList<T>(
175175
minColumnWidth,
176176
columns
177177
);
178-
if (!arraysMatch(widths, pixelWidths)) {
179-
setPixelWidths(widths);
180-
}
181-
}, [width, remainingCols, fixedWidth, minColumnWidth, pixelWidths, columns]);
178+
179+
setPixelWidths(prev => !arraysMatch(widths, prev) ? widths : prev);
180+
}, [width, remainingCols, fixedWidth, minColumnWidth, columns]);
182181

183182
// remeasure if the rowHeight changes
184183
useLayoutEffect(() => {

0 commit comments

Comments
 (0)