Skip to content
Discussion options

You must be logged in to vote

Unfortunately this is not possible. Lit 2 uses a WeakMap to cache the templates and identify which parts needs updating. The WeakMap needs static references that are only possible with JS template strings. If the strings are built at runtime Lit will update the full template every time for each tiny change creating performance issues. There's a discussion in #4

However, Lit accepts iterables in the template holes. So if your list is not expected to change (so you don't need Lit.mapUnique), you can just pass the templates iterable without concatenating the strings. In the code below I just add svg in createBar to return a LitTemplate and remove |> String.Concat below.

let createBar index v…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by leolorenzoluis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants