You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing a bug, where when having an empty list (ie. size parameter in useVirtual is 0), the returned virtualRow array still contains a single element. That single element is "empty", as it is an object that only contains a measureRef key, and none of the other keys (index, start, end, size).
Reproduction
I've created a minimal reproduction of the issue at https://codesandbox.io/s/amazing-glade-eo7vw?file=/src/index.js which is a fork of the "Dynamic Rows" example. It starts off with having an empty list, and then after 5 seconds, changes the list to have items. The console log (and the error) shows that we start with an empty virtualRow, and then get correct virtualRows after 5 seconds.
What should happen instead, is that no console logs are present in the beginning, because the virtualRows array should be empty.
Context
I believe this bug was introduced in version 2.2.4 by #48. Downgrading to version 2.2.3 "fixes" the issue. But as the changes in that PR are rather substantial, I haven't been able to pinpoint exactly where the problem is. Pinging @mogelbrod
Thanks for the ping!
I was sure I had tested this rather obvious case, but apparently not with the final code - my bad 😞
This project could definitely use some additional test cases, if anybody's up for writing some 😅
Bug Report
I'm experiencing a bug, where when having an empty list (ie.
size
parameter inuseVirtual
is 0), the returnedvirtualRow
array still contains a single element. That single element is "empty", as it is an object that only contains ameasureRef
key, and none of the other keys (index
,start
,end
,size
).Reproduction
I've created a minimal reproduction of the issue at https://codesandbox.io/s/amazing-glade-eo7vw?file=/src/index.js which is a fork of the "Dynamic Rows" example. It starts off with having an empty list, and then after 5 seconds, changes the list to have items. The console log (and the error) shows that we start with an empty
virtualRow
, and then get correctvirtualRows
after 5 seconds.What should happen instead, is that no console logs are present in the beginning, because the
virtualRows
array should be empty.Context
I believe this bug was introduced in version
2.2.4
by #48. Downgrading to version2.2.3
"fixes" the issue. But as the changes in that PR are rather substantial, I haven't been able to pinpoint exactly where the problem is. Pinging @mogelbrodThis might be the same bug as #49.
Workaround
Current workarounds are:
2.2.3
virtualRows
, ensure that you have at least one rawitem
(and NOT just onevirtualRow
), eg.The text was updated successfully, but these errors were encountered: