bvaughn / react-window

React components for efficiently rendering large lists and tabular data
https://react-window.now.sh/
MIT License
15.54k stars 779 forks source link

Onscroll event is triggered unexpected and list scroll up with random height when the list data has been updated by Input onchange event #708

Open MEDASSSSSSS opened 1 year ago

MEDASSSSSSS commented 1 year ago

There is a input in every row, and the value of input is controlled by the list data. After onchange event of the input in row is triggered, the list data is updated, and the list scroll up with some random height. After some debugger, I only found the onscroll event is triggered unexpected, then List component will update because of this event. But I don't know why the scroll event is triggered under I didn't do anything to scroll the list.

Here is the demo: https://codesandbox.io/s/react-window-input-onchange-issue-lsoj3h?file=/index.js

OneMoreJack commented 10 months ago

Just run into the same issue!

OneMoreJack commented 10 months ago

For anyone who may run into the same problem, check if there's any state updating when you typing in an input. DO NOT manage input values by an state. Instead you need an Form (for example: antd) to manage input value.