T
TanStack2y ago
eastern-cyan

Missing documentation on scrollingDelay

I am recently trying to improve scrolling performance of a data grid built on react-virtual. I found setting a much lower scrollingDelay greatly improve the perceived scrolling performance. I didn't know about this prop until digging into the source code, as it wasn't mentioned anywhere in documentation. Shouldn't we add some documentation for it?
2 Replies
rare-sapphire
rare-sapphire2y ago
Hi, that is interesting, scrollingDelay should not affect overall scrolling performance. if you read the code it's just controlling the timeout delay for isScrolling. Overall this should be refactor to https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollend_event the timeout dropped
MDN Web Docs
Element: scrollend event - Web APIs | MDN
The scrollend event fires when element scrolling has completed. Scrolling is considered completed when the scroll position has no more pending updates and the user has completed their gesture.
eastern-cyan
eastern-cyanOP2y ago
I thought it wouldn't until I see how much difference it made. With the default 150ms, our table doesn't scroll smoothly, more like about 25px at a time. It is most noticeable when scrolling slowly with a trackpad. When I reduce the delay to 1ms, the scrolling becomes very smooth. Using scrollend event sounds like a promising refactor though.

Did you find this page helpful?