From 3d2033db6b0ac1f47ef0b02232297b7785973469 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Fri, 24 Jul 2026 20:15:43 -0500 Subject: [PATCH] refactor(desktop): memoize the directive image-segment filter Matches the two derived values above it and fixes the indentation. --- .../src/components/assistant-ui/directive-text.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/components/assistant-ui/directive-text.tsx b/apps/desktop/src/components/assistant-ui/directive-text.tsx index 4f9f489d872c..ffa63a7b8877 100644 --- a/apps/desktop/src/components/assistant-ui/directive-text.tsx +++ b/apps/desktop/src/components/assistant-ui/directive-text.tsx @@ -354,10 +354,14 @@ export function DirectiveContent({ text }: { text: string }) { // `@image:` directives render as a block-level thumbnail row (like // embedded base64 images below), not inline mid-text — otherwise a large // thumbnail gets wedged between words and breaks the text's line flow. - const imageSegments = segments.filter( - (segment): segment is Extract => - segment.kind === 'mention' && segment.type === 'image' -) + const imageSegments = useMemo( + () => + segments.filter( + (segment): segment is Extract => + segment.kind === 'mention' && segment.type === 'image' + ), + [segments] + ) return (