@@ -55,7 +55,7 @@ import TableContext from './context/TableContext';
5555import BodyContext from './context/BodyContext' ;
5656import Body from './Body' ;
5757import useColumns from './hooks/useColumns' ;
58- import { useFrameState } from './hooks/useFrame' ;
58+ import { useFrameState , useTimeoutLock } from './hooks/useFrame' ;
5959import { getPathValue , mergeObject , validateValue , newArr } from './utils/valueUtil' ;
6060import ResizeContext from './context/ResizeContext' ;
6161import useStickyOffsets from './hooks/useStickyOffsets' ;
@@ -344,6 +344,8 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
344344 } ) ;
345345 }
346346
347+ const [ setScrollTarget , getScrollTarget ] = useTimeoutLock ( null ) ;
348+
347349 function forceScroll ( scrollLeft : number , target : HTMLDivElement ) {
348350 /* eslint-disable no-param-reassign */
349351 if ( target && target . scrollLeft !== scrollLeft ) {
@@ -354,8 +356,13 @@ function Table<RecordType extends DefaultRecordType>(props: TableProps<RecordTyp
354356
355357 const onScroll : React . UIEventHandler < HTMLDivElement > = ( { currentTarget } ) => {
356358 const { scrollLeft, scrollWidth, clientWidth } = currentTarget ;
357- forceScroll ( scrollLeft , scrollHeaderRef . current ) ;
358- forceScroll ( scrollLeft , scrollBodyRef . current ) ;
359+
360+ if ( ! getScrollTarget ( ) || getScrollTarget ( ) === currentTarget ) {
361+ setScrollTarget ( currentTarget ) ;
362+
363+ forceScroll ( scrollLeft , scrollHeaderRef . current ) ;
364+ forceScroll ( scrollLeft , scrollBodyRef . current ) ;
365+ }
359366
360367 setPingedLeft ( scrollLeft > 0 ) ;
361368 setPingedRight ( scrollLeft < scrollWidth - clientWidth ) ;
0 commit comments