developit / developit/preact-virtual-list

Instead of a data prop, allow for an item getter function

Open
#3 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
231
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I implemented something similar to this and if you truly are going to make 1M rows available for scrolling, you definitely don't want them all in memory at the same time.

The way I got around this was to have my component accept a getRow() function that when called with an index returns a Promise. When the promise resolves, the data is then popped into the listview. If the row is already in the backing store, it's easy enough to ship a pre-resolved Promise. You'd use a storage pattern like an LRU to keep overall memory impact low.

Cheers!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.