mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[IMP] component, reactivity: add subscription getter in dev mode
This allows to see which objects and which keys in those objects a component is observing, so that issues with missing renders or extra renders can be more easily diagnosed.
This commit is contained in:
committed by
Géry Debongnie
parent
6908102a72
commit
8920b4b93a
@@ -153,6 +153,17 @@ export function clearReactivesForCallback(callback: Callback): void {
|
||||
targetsToClear.clear();
|
||||
}
|
||||
|
||||
export function getSubscriptions(callback: Callback) {
|
||||
const targets = callbacksToTargets.get(callback) || [];
|
||||
return [...targets].map((target) => {
|
||||
const keysToCallbacks = targetToKeysToCallbacks.get(target);
|
||||
return {
|
||||
target,
|
||||
keys: keysToCallbacks ? [...keysToCallbacks.keys()] : [],
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const reactiveCache = new WeakMap<Target, WeakMap<Callback, Reactive>>();
|
||||
/**
|
||||
* Creates a reactive proxy for an object. Reading data on the reactive object
|
||||
|
||||
Reference in New Issue
Block a user