Skip to content

Commit

Permalink
refactor: simplified code
Browse files Browse the repository at this point in the history
  • Loading branch information
askwuxue committed Jun 21, 2023
1 parent 3e861fb commit 9fb3946
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/hooks/src/useRequest/src/utils/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ interface RecordData extends CachedData {
const cache = new Map<CachedKey, RecordData>();

const setCache = (key: CachedKey, cacheTime: number, cachedData: CachedData) => {
const currentCache = cache.get(key);
if (currentCache?.timer) {
clearTimeout(currentCache.timer);
}
const currentCache = getCache(key);
clearTimeout(currentCache?.timer);

let timer: Timer | undefined = undefined;

Expand Down

0 comments on commit 9fb3946

Please sign in to comment.