From 122ecb5769e20173c99033ade0057d38e12cb384 Mon Sep 17 00:00:00 2001
From: Owen Jacobson <owen@grimoire.ca>
Date: Fri, 15 Nov 2024 01:18:41 -0500
Subject: HTML-ify message bodies once, on receipt, and not every time the
 message is rendered.

~16% of the `hi development` channel's rendering time was taken up on this.
---
 ui/lib/components/Message.svelte | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

(limited to 'ui/lib/components/Message.svelte')

diff --git a/ui/lib/components/Message.svelte b/ui/lib/components/Message.svelte
index 0c8eeec..fddeecd 100644
--- a/ui/lib/components/Message.svelte
+++ b/ui/lib/components/Message.svelte
@@ -1,15 +1,11 @@
 <script>
-  import { marked } from 'marked';
-  import DOMPurify from 'dompurify';
-
   import { deleteMessage } from '$lib/apiServer';
 
   function scroll(message) {
     message.scrollIntoView();
   }
 
-  let { id, at, body, editable = false } = $props();
-  let renderedBody = $derived(DOMPurify.sanitize(marked.parse(body, { breaks: true })));
+  let { id, at, body, renderedBody, editable = false } = $props();
   let deleteArmed = $state(false);
 
   function onDelete(event) {
-- 
cgit v1.2.3

