jwstegemann / fritz2

Easily build reactive web-apps in Kotlin based on flows and coroutines.
https://www.fritz2.dev
MIT License
656 stars 28 forks source link

Improve render performance of render each #751

Open jwstegemann opened 1 year ago

jwstegemann commented 1 year ago

For larger lists and/or situations, where often a long list of patches results from the diff of two consecutive versions of the lists, it might be a good idea to

This should improve rendering performance, avoid flickering when for example sorting a huge table, and make sure that animations on single elements all start at the same time (when the copy is mounted to the dom).

For small lists or lists that only result in very few patches between two versions, this might add some unnecessary overhead, so we would either accept this or find a way to make this behavior controllable over the api.

ghost commented 1 year ago

As we already have four parameters for renderEach we must be careful to add another one.

Probably it makes more sense to encapsulate this behavior into the function name (renderBatch, renderEachBatched or alike).

We should first consider to try to measure whether we need two behavior variants, or we can stick only to the proposed one. This would be the best solution, as the user must not make any design decisions upfront.