T
TanStack•3y ago
manual-pink

Usage when estimateSize should be updated after mount?

I'm currently trying to calculate each item's size after mount (item count / view window size), but the virtualizer doesn't reflect the size change. I understand that it is not a good idea to calculate size changes every time the estimateSize function reference changes, but it's making my usecase unusable 😭 Maybe we could introduce something like a key option to reinitialize (or at least recalculate) the virtualizer after mount 🤔 not sure if it's the best way to solve the problem though.
2 Replies
manual-pink
manual-pinkOP•3y ago
Well, setting count to zero on first render actually solved the issue 😂
correct-apricot
correct-apricot•3y ago
Do you need to calculate the size ? I believe you should be able to use the dynamic virtualizer example to measure elements and it automatically adjusts. I've just used this for my dropdown components

Did you find this page helpful?