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:
committed by
GitHub
co-authored by
Isaac Sanchez
parent
4a79af3fb7
commit
71e902fec6
@@ -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 };
|
||||
|
||||
Reference in New Issue
Block a user