mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] reactivity: fix memory leak
The reactive cache should be a WeakMap from targets to another WeakMap that associates callbacks to target. The second WeakMap was in fact a map, and typescript did not complain because Map has compatible typing with WeakMap. This commit fixes that.
This commit is contained in:
+1
-1
@@ -207,7 +207,7 @@ export function reactive<T extends Target>(
|
||||
return reactive(originalTarget, callback);
|
||||
}
|
||||
if (!reactiveCache.has(target)) {
|
||||
reactiveCache.set(target, new Map());
|
||||
reactiveCache.set(target, new WeakMap());
|
||||
}
|
||||
const reactivesForTarget = reactiveCache.get(target)!;
|
||||
if (!reactivesForTarget.has(callback)) {
|
||||
|
||||
Reference in New Issue
Block a user