react-ui
react-ui copied to clipboard
`ScrollView` prop `autoScroll: detectEnd` race condition
Originally reported in https://github.com/react-ui-org/react-ui/issues/501
Steps to reproduce:
- in the documentation go to the Auto Scrolling section
- select the option when end is detected
- click on the Add text button to the point where the element scrolls
- start clicking on Add text button as fast as you can several times
- after a while, auto scroll stops working
https://github.com/user-attachments/assets/346aef66-0d7f-4173-bba7-173a3469c7e4
Relevant comment: https://github.com/react-ui-org/react-ui/issues/501#issuecomment-3018784601
I think the issue lies in a race condition in the else if (!isScrolledAtEnd || isAutoScrollInProgress) condition, but I couldn't think of a satisfactory fix.