Closed mauricedb closed 1 month ago
it's still there. "version": "9.21.0"
I am still experiencing this behavior on version 9.22.3
, but I was able to ameliorate it pretty easily by storing the value dataGridIsScrolling
in state and forcing one last update after we are done scrolling.
const [dataGridIsScrolling, setDataGridIsScrolling] = useState<boolean>(false);
useEffect(() => {
// This allows us to trigger rendering the tooltips once we have stopped scrolling.
// We do this because rendering the tooltips while scrolling causes the component to lag,
// and the tooltips are not useful while the grid is scrolling.
if (multiGridRef !== null && dataGridIsScrolling == false) {
multiGridRef.forceUpdateGrids();
}
}, [dataGridIsScrolling])
...
return <MultiGrid cellRenderer={cellRenderer} ref={ref => setMultiGridRef(ref)} ... />;
What is the current behavior?
Using the MultiGrid cellRenderer the isScrolling argument is only true on the grid that scrolls, the other grids will always report isScrolling as false.
The downside here is that optimizations to code based on the isScrolling argument can't be done. In my specific case, I get quite a bit of lag with the row headers dragging slower due to drag&drop, context menu and swipe logic in there. As none of that can actually happen when scrolling I want to use the isScrolling argument to render a simpler row header.
See https://codesandbox.io/s/z6921736wx for a working example. Scroll using the mouse wheel or slider bar and observe that only the grid that is scrolled updates the status in the cell.
What is the expected behavior?
I expect the isScrolling argument to be correct in each of the four connected Grid instances.
Which versions of React and react-virtualized, and which browser / OS are affected by this issue? Did this work in previous versions of react-virtualized?