diff --git a/packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx b/packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx index e5bf5410f4ccf..912ed05493532 100644 --- a/packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx +++ b/packages/x-data-grid/src/components/virtualization/GridVirtualScrollbar.tsx @@ -70,8 +70,8 @@ const GridVirtualScrollbar = React.forwardRef(null); const contentRef = React.useRef(null); const classes = useUtilityClasses(rootProps, props.position); @@ -96,34 +96,28 @@ const GridVirtualScrollbar = React.forwardRef { const scroller = apiRef.current.virtualScrollerRef.current!; const scrollbar = scrollbarRef.current!; - if (isLocked.current) { - isLocked.current = false; + if (scrollbar[propertyScroll] === lastPositionScrollbar.current) { return; } - isLocked.current = true; const value = scrollbar[propertyScroll] / scrollbarInnerSize; scroller[propertyScroll] = value * contentSize; + + lastPositionScroller.current = scroller[propertyScroll]; }); useOnMount(() => {