petyosi / react-virtuoso

The most powerful virtual list component for React
https://virtuoso.dev
MIT License
5.25k stars 301 forks source link

Dynamic container height error #144

Closed boomfly closed 4 years ago

boomfly commented 4 years ago

I am writing messenger app and try to make messages list starting from bottom.

Here example of issue: https://stackblitz.com/edit/react-virtuoso-container-autoheight-issue?file=example.js

Type some message and press button.

When new message added to list, Virtuoso height and top values recalculated and throws this error:

TypeError: Cannot read property '0' of undefined

But if uncomment line 31-33 which add some messages and fill full height it works normal without exceptions.

Error occurs in https://github.com/petyosi/react-virtuoso/blob/0f29dce3818d25817ceef0dea8228e1e3811c349/src/GroupIndexTransposer.ts#L66

petyosi commented 4 years ago

@boomfly I think I found the issue (some 0 / 0 divisions). Can you test with 0.17.6-beta? It works in the example you gave.

boomfly commented 4 years ago

@petyosi Thanks! It work, but i can't find source of 0.17.6-beta. It's your local version?

petyosi commented 4 years ago

Yeah, I haven't pushed yet. I wanted to verify the fix with you before I publish the next release.

petyosi commented 4 years ago

@boomfly I published 0.17.6