developit / developit/preact-virtual-list

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

Offen
#3 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
JavaScript
Sterne
231
Forks
24
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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!

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.