tbranyen / hyperlist

A performant virtual scrolling list utility capable of rendering millions of rows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refresh issues on swapping out the data with larger data sets

joshbartley opened this issue · comments

While working on using this plugin, I was swapping out content, first I just created a new instance, then switched to using refresh. I noticed an issue that everyone was on one line because the calculation was returning undefined, so the top css attribute wasn't being set.

I found that by removing the check if this._itemPositions already exists, and creating a new array each time, that the issues went away. Checking the examples, they do not have data that increases the size/length of the data after the first load. I wanted to check that this was the correct way to go about this or if I need to create a PR.

https://github.com/tbranyen/hyperlist/blob/master/lib/index.js#L224

I was able to fix this by running the destroy() method before re-instantiating, instead of using the refresh() method.