Skip to content

Commit 7029c4e

Browse files
authored
fix: sync scroll bar when columns changed (#663)
* fix: sync scroll bar when `columns` changed * Chnage columns to cloumns.length
1 parent 730d4df commit 7029c4e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Table.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,13 +492,13 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
492492
}
493493
};
494494

495-
// Sync scroll bar when init or `horizonScroll` & `data` changed
495+
// Sync scroll bar when init or `horizonScroll`, `data` and `columns.length` changed
496496
React.useEffect(() => triggerOnScroll, []);
497497
React.useEffect(() => {
498498
if (horizonScroll) {
499499
triggerOnScroll();
500500
}
501-
}, [horizonScroll, data]);
501+
}, [horizonScroll, data, columns.length]);
502502

503503
// ===================== Effects ======================
504504
const [scrollbarSize, setScrollbarSize] = React.useState(0);

0 commit comments

Comments
 (0)