[BUG] Sticky group header flickers during fast scroll in GroupedVirtuoso
Describe the bug
There is a visual glitch when using GroupedVirtuoso with sticky group headers. During fast scrolling, it seems that the sticky header content sometimes updates one frame later than the scroll position, causing the next group header to appear overscrolled for a moment.
It can be difficult to notice, but overall it feels like the group header is slightly unstable during fast scrolling.
Reproduction
The issue can be reproduced in the official example: https://virtuoso.dev/react-virtuoso/grouped-virtuoso/grouped-numbers/
To Reproduce
Steps to reproduce the behavior:
- Open the example above
- Scroll quickly
- Observe the sticky group header while scrolling fast
- Occasionally the sticky header content updates one frame late, and the next group header becomes visible briefly with shifted position
Expected behavior
Stable update of sticky header content without flickering during fast scroll.
Screenshots
The next two screenshots show the header overscroll case compared to the normal state when the sticky header content updates successfully.
Desktop (please complete the following information):
- Browsers: Chrome, Safari
- OS: macOS
Source: petyosi/react-virtuoso