From 45693e84bd1c178dea817b0465674e47779b8465 Mon Sep 17 00:00:00 2001 From: c_w_xiaohei <1641233466@qq.com> Date: Tue, 25 Aug 2026 18:21:20 +0800 Subject: [PATCH] perf(ui): widen markdown session cache Retain detached Markdown DOM for eight recent sessions so medium-frequency session switching can restore more first-screen content without reparsing it. Limit each session to four cached parts, reducing the worst-case retained fragment count from 36 to 32 while preventing long sessions from dominating the cache. --- .../components/chat/markdown/detachedMarkdownDomCache.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/components/chat/markdown/detachedMarkdownDomCache.ts b/packages/ui/src/components/chat/markdown/detachedMarkdownDomCache.ts index 58ae0258..09f94291 100644 --- a/packages/ui/src/components/chat/markdown/detachedMarkdownDomCache.ts +++ b/packages/ui/src/components/chat/markdown/detachedMarkdownDomCache.ts @@ -27,10 +27,10 @@ type DetachedMarkdownDomCacheLimits = { type SessionCache = Map; const DEFAULT_LIMITS: DetachedMarkdownDomCacheLimits = { - // Three buckets cover the common A/B/C recent-session rotation without + // Eight buckets cover a broader recent-session working set without // coupling eviction to React commit or microtask timing. - maxSessions: 3, - maxEntriesPerSession: 12, + maxSessions: 8, + maxEntriesPerSession: 4, }; export class DetachedMarkdownDomCache {