You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(web): Command Palette thread search misses all WeakMap caches on every keystroke #42338
In apps/web/src/components/CommandPalette.logic.ts, buildThreadActionItems constructs a new wrapper object ({ ...thread, latestUserMessageAt: thread.latestUserMessageAt ?? null, opens: thread.opens ?? null }) before calling threadSearchSubject(...).
Because threadSearchSubject (packages/client-runtime/src/state/threadSearch.ts) memoizes each thread's ThreadSearchSubject in a WeakMap keyed by thread object identity — and packages/shared/src/paletteSearch.ts caches WeightedSearchField[] and folded/tokenized SearchField instances per ThreadSearchSubject — passing a newly spread object causes all three cache layers to miss on 100% of threads on every keystroke in CommandPaletteThreadItems.tsx.
Making latestUserMessageAt, latestUserAuthoredMessageAt, and opens optional on ThreadSearchShell (their consumers already handle undefined) and passing thread directly restores the WeakMap cache hits on every keystroke.
Fixed by #42988, now on main: With unchanged threads, typing successive characters in the command palette now reuses the same thread items and search subjects, so the weighted-field and tokenization caches survive keystrokes instead of missing for every thread.
Activity
juliusmarminge commentedon Nov 25, 2026
Fixed by #42988, now on main: With unchanged threads, typing successive characters in the command palette now reuses the same thread items and search subjects, so the weighted-field and tokenization caches survive keystrokes instead of missing for every thread.