Skip to content

Commit

Permalink
fix(useScrollListener): can't perform a React state update on an unmo…
Browse files Browse the repository at this point in the history
…unted component (#306)

* fix React warnings: can't perform a React state update on an unmounted component

* fix React warnings: can't perform a React state update on an unmounted component
  • Loading branch information
simonguo committed Feb 9, 2022
1 parent ba059bd commit f2104f1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/useScrollListener.ts
Expand Up @@ -371,7 +371,11 @@ const useScrollListener = (props: ScrollListenerProps) => {

const rerender = () => {
setScrolling(true);
setTimeout(() => setScrolling(false), 0);
setTimeout(() => {
if (tableBodyRef.current) {
setScrolling(false);
}
}, 0);
};

const getControlledScrollLeftValue = value => {
Expand Down

0 comments on commit f2104f1

Please sign in to comment.