Skip to content
TypeScript

fix(web): stop remounting markdown on every activity delta (#9306)

Julius Marminge355fbd96d5e9
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index 64ca547ee1a..26a2881322b 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -623,7 +623,11 @@ export const MessagesTimeline = memo(function MessagesTimeline({
listRef,
timestampFormat,
routeThreadKey,
- threadRef: parseScopedThreadKey(routeThreadKey),
+ // Must be referentially stable: ChatMarkdown keys its react-markdown
+ // component map on threadRef, and a fresh object here remounts every
+ // rendered markdown node whenever this memo recomputes (e.g. on each
+ // activity delta while the thread is working).
+ threadRef: citationThreadRef,
markdownCwd,
resolvedTheme,
workspaceRoot,
@@ -648,6 +652,7 @@ export const MessagesTimeline = memo(function MessagesTimeline({
listRef,
timestampFormat,
routeThreadKey,
+ citationThreadRef,
markdownCwd,
resolvedTheme,
workspaceRoot,