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.
This commit is contained in:
c_w_xiaohei
2026-08-26 00:44:14 +08:00
parent fa1503a038
commit 45693e84bd
@@ -27,10 +27,10 @@ type DetachedMarkdownDomCacheLimits = {
type SessionCache = Map<string, DetachedMarkdownDom>;
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 {