Skip to content

Commit

Permalink
fix: Sync scroll bar when data change (react-component#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
lanten committed Jul 9, 2021
1 parent e26c552 commit e84e7c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,13 +492,13 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
}
};

// Sync scroll bar when init or `horizonScroll` changed
// Sync scroll bar when init or `horizonScroll` & `data` changed
React.useEffect(() => triggerOnScroll, []);
React.useEffect(() => {
if (horizonScroll) {
triggerOnScroll();
}
}, [horizonScroll]);
}, [horizonScroll, data]);

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

0 comments on commit e84e7c5

Please sign in to comment.