Skip to content

Commit

Permalink
Fix reduced motion mode causing 500 on ssr (#1177)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin authored May 27, 2024
1 parent fcf98c2 commit 0b4f7ba
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/components/chat/ChatMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { marked, type MarkedOptions } from "marked";
import markedKatex from "marked-katex-extension";
import type { Message, MessageFile } from "$lib/types/Message";
import { afterUpdate, createEventDispatcher, tick } from "svelte";
import { afterUpdate, createEventDispatcher, onMount, tick } from "svelte";
import { deepestChild } from "$lib/utils/deepestChild";
import { page } from "$app/stores";
Expand Down Expand Up @@ -88,7 +88,8 @@
let initialized = false;
const reducedMotionMode = isReducedMotion(window);
let reducedMotionMode = false;
const renderer = new marked.Renderer();
// For code blocks with simple backticks
renderer.codespan = (code) => {
Expand Down Expand Up @@ -124,6 +125,10 @@
$: emptyLoad =
!message.content && (webSearchIsDone || (searchUpdates && searchUpdates.length === 0));
onMount(() => {
reducedMotionMode = isReducedMotion(window);
});
afterUpdate(() => {
if (reducedMotionMode) {
return;
Expand Down

0 comments on commit 0b4f7ba

Please sign in to comment.