Skip to content

Commit 24832a5

Browse files
authored
Fix timer ID memory leak with maxAge option (#109)
Fixes #103
1 parent 3a5eb3d commit 24832a5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ export default function memoize<
142142
if (computedMaxAge && computedMaxAge > 0 && computedMaxAge !== Number.POSITIVE_INFINITY) {
143143
const timer = setTimeout(() => {
144144
cache.delete(key);
145+
cacheTimerStore.get(function_)?.delete(timer as unknown as number);
145146
}, computedMaxAge);
146147

147148
timer.unref?.();

0 commit comments

Comments
 (0)