kweb-core icon indicating copy to clipboard operation
kweb-core copied to clipboard

Reduce unnecessary DOM rendering from renderEach() in prelude.kt

Open sanity opened this issue 5 years ago • 1 comments

Create an extension function for rendering Collections within KVars:

val c : KVar<List<Int>> = KVar(listOf(1, 2, 3))
// inside Kweb {}
renderEach(c) { v : KVar<Int> ->
  h1().text(v.map { it.toString() })
}

The trick here will be to efficiently handle element insertion and deletion while minimizing DOM modifications.

see also: https://github.com/kwebio/kweb-core/issues/123#issuecomment-622941084

sanity avatar May 02 '20 16:05 sanity

Simple implementation of this here released in 0.7.12, although unnecessarily re-renders list if the list size changes so leaving this issue open until that can be made more efficient.

sanity avatar May 09 '20 17:05 sanity

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Oct 12 '22 03:10 github-actions[bot]