fix(ui): ignore stale file search results (#1143)

* fix(ui): ignore stale file search results

* fix(ui): skip stale file search notifications

---------

Co-authored-by: Isaac Sanchez <isanchez-hawkins@arize.com>
This commit is contained in:
Isaac Sanchez-Hawkins
2026-05-08 15:18:48 +03:00
committed by GitHub
co-authored by Isaac Sanchez
parent 4a79af3fb7
commit 71e902fec6
2 changed files with 100 additions and 0 deletions
@@ -77,6 +77,10 @@ export const useFileSearchStore = create<FileSearchStoreState>()(
})
.then((files) => {
set((state) => {
if (state.inFlight[key] !== searchPromise) {
return state;
}
const nextCache = { ...state.cache, [key]: { files, timestamp: Date.now() } };
const nextKeys = state.cacheKeys.filter((cacheKey) => cacheKey !== key);
nextKeys.push(key);
@@ -97,6 +101,10 @@ export const useFileSearchStore = create<FileSearchStoreState>()(
})
.finally(() => {
set((state) => {
if (state.inFlight[key] !== searchPromise) {
return state;
}
const nextInFlight = { ...state.inFlight };
delete nextInFlight[key];
return { inFlight: nextInFlight };