From 29f6c72e879d67f23021938e24a21914cc9fb120 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Sat, 9 May 2026 06:44:42 +0900 Subject: [PATCH] refac --- src/lib/components/chat/Messages/Markdown.svelte | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Messages/Markdown.svelte b/src/lib/components/chat/Messages/Markdown.svelte index 3cbef944e4..bfea80b80b 100644 --- a/src/lib/components/chat/Messages/Markdown.svelte +++ b/src/lib/components/chat/Messages/Markdown.svelte @@ -71,11 +71,17 @@ }; const updateHandler = (content) => { - if (content && !pendingUpdate) { - pendingUpdate = requestAnimationFrame(() => { + if (content) { + if (done) { + cancelAnimationFrame(pendingUpdate); pendingUpdate = null; parseTokens(); - }); + } else if (!pendingUpdate) { + pendingUpdate = requestAnimationFrame(() => { + pendingUpdate = null; + parseTokens(); + }); + } } };