Skip to content

Commit 0b4f7ba

Browse files
authored
Fix reduced motion mode causing 500 on ssr (#1177)
1 parent fcf98c2 commit 0b4f7ba

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib/components/chat/ChatMessage.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { marked, type MarkedOptions } from "marked";
33
import markedKatex from "marked-katex-extension";
44
import type { Message, MessageFile } from "$lib/types/Message";
5-
import { afterUpdate, createEventDispatcher, tick } from "svelte";
5+
import { afterUpdate, createEventDispatcher, onMount, tick } from "svelte";
66
import { deepestChild } from "$lib/utils/deepestChild";
77
import { page } from "$app/stores";
88
@@ -88,7 +88,8 @@
8888
8989
let initialized = false;
9090
91-
const reducedMotionMode = isReducedMotion(window);
91+
let reducedMotionMode = false;
92+
9293
const renderer = new marked.Renderer();
9394
// For code blocks with simple backticks
9495
renderer.codespan = (code) => {
@@ -124,6 +125,10 @@
124125
$: emptyLoad =
125126
!message.content && (webSearchIsDone || (searchUpdates && searchUpdates.length === 0));
126127
128+
onMount(() => {
129+
reducedMotionMode = isReducedMotion(window);
130+
});
131+
127132
afterUpdate(() => {
128133
if (reducedMotionMode) {
129134
return;

0 commit comments

Comments
 (0)