The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
refactor(desktop): memoize the directive image-segment filter
Brooklyn Nicholson3d2033db6b0a
diff --git a/apps/desktop/src/components/assistant-ui/directive-text.tsx b/apps/desktop/src/components/assistant-ui/directive-text.tsxindex 4f9f489d872..ffa63a7b887 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:<path>` 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<Unstable_DirectiveSegment, { kind: 'mention' }> =>- segment.kind === 'mention' && segment.type === 'image'-)+ const imageSegments = useMemo(+ () =>+ segments.filter(+ (segment): segment is Extract<Unstable_DirectiveSegment, { kind: 'mention' }> =>+ segment.kind === 'mention' && segment.type === 'image'+ ),+ [segments]+ )return (<span className="whitespace-pre-line" data-slot="aui_directive-text">