TimLariviere / Fabulous-new

Fabulous v2 - Work in progress
https://timothelariviere.com/Fabulous-new/
Other
41 stars 3 forks source link

[Architecture] Support virtualized collections #9

Closed TimLariviere closed 2 years ago

TimLariviere commented 2 years ago

2 ways to represent item collection controls such as ListView, CollectionView, CarouselView, etc.

// Virtualized list
ListView(items, fun item -> item.Id, fun item ->
    TextCell(item.Text)
)

// Explicit list
ListView([
    for item in items do
        TextCell(item.Text)
            .key(item.Id)
])

In v1, we're only supporting explicit lists but it has a lot of constraints. Virtualization is hard to do and if you happen to have 1 million items in your list, it would completely kill the performance (view function + diffing).

So I think it would be better to create 2 kinds of lists ListView + VirtualizedListView to support better virtualization.