-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Closed
Description
Describe the bug
My workaround is to not call the function from {@html }, but rather use $effect to calculate the value:
H4sIAAAAAAAAA41SwY7TMBD9lWHYQ6KNEs6lrYg4wAFugQvm4CZj1cIZW_Zkl1WUf0dOaLtSOXCy_GbmzXvPntFYRwl3P2ZkPRLusA0BK5SXkC_piZwQVpj8FPuM7FMfbZCjYiV2DD4KdFFzRk8EJvoRFNbNDas3DoV5wpFA7ycWOMBDEi1UvCvfK77U0g2fB9Y7UPip7br2Y6twKXOX4n1zk8DzW2sg1QPrJVf3r7ScLA
Offending component code:
<script>
let {s = $bindable()} = $props();
function transcribeToHTML() {
if (!s.rna) {
// Very expensive operation (parse markdown with a lot of formulas) in real applicaton
// The result is cached.
s.rna = "<p>" + s.dna.replaceAll("T", "U") + "</p>"
}
return s.rna
}
</script>
{@html transcribeToHTML()}
which is included inside {#if } in the parent.
I'm not sure if this is a bug or I misunderstood something.
Reproduction
run in playground
Logs
No response
System Info
.268, playgroundSeverity
annoyance
Metadata
Metadata
Assignees
Labels
No labels