diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index b79f465af..a714718f3 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -271,19 +271,13 @@ __builtins__.input = input`); render(); } - $: if (lang) { - dispatchCode(); - } - - const dispatchCode = () => { - dispatch('code', { lang, code }); - }; + $: dispatch('code', { lang, code }); onMount(async () => { console.log('codeblock', lang, code); if (lang) { - dispatchCode(); + dispatch('code', { lang, code }); } if (document.documentElement.classList.contains('dark')) { mermaid.initialize({