diff --git a/src/state/internal/createQueryStore.ts b/src/state/internal/createQueryStore.ts index 463a1970a5b..5bf6ab94c74 100644 --- a/src/state/internal/createQueryStore.ts +++ b/src/state/internal/createQueryStore.ts @@ -370,10 +370,9 @@ export function createQueryStore< const createState: StateCreator = (set, get, api) => { const pruneCache = (state: S): S => { - const now = Date.now(); const newCache: Record> = {}; Object.entries(state.queryCache).forEach(([key, entry]) => { - if (entry && now - entry.lastFetchedAt <= cacheTime) { + if (entry && Date.now() - entry.lastFetchedAt <= cacheTime) { newCache[key] = entry; } });