feat(search): warm tpuf cache on overlay open (#1464)

This commit is contained in:
Kian Jones
2026-03-23 14:56:15 -07:00
committed by GitHub
parent 7b29a0005f
commit c7278b23a3

View File

@@ -128,6 +128,22 @@ export function MessageSearch({
// Cache results per query+mode+range combination to avoid re-fetching
const resultsCache = useRef<Map<string, MessageSearchResponse>>(new Map());
// Warm tpuf cache on mount (fire-and-forget)
useEffect(() => {
const warmCache = async () => {
try {
const client = await getClient();
await client.post("/v1/messages/search", {
body: {},
query: { warm_only: true },
});
} catch {
// Silently ignore - cache warm is best-effort
}
};
void warmCache();
}, []);
// Get cache key for a specific query+mode+range combination
const getCacheKey = useCallback(
(query: string, mode: SearchMode, range: SearchRange) => {