Log when a derived gets cleared (#236739)
parent
094e96a2ea
commit
83c336d7d6
|
@ -220,6 +220,7 @@ export class Derived<T, TChangeSummary = any> extends BaseObservable<T, void> im
|
|||
*/
|
||||
this.state = DerivedState.initial;
|
||||
this.value = undefined;
|
||||
getLogger()?.handleDerivedCleared(this);
|
||||
for (const d of this.dependencies) {
|
||||
d.removeObserver(this);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ export interface IObservableLogger {
|
|||
|
||||
handleDerivedCreated(observable: Derived<any>): void;
|
||||
handleDerivedRecomputed(observable: Derived<any>, info: IChangeInformation): void;
|
||||
handleDerivedCleared(observable: Derived<any>): void;
|
||||
|
||||
handleBeginTransaction(transaction: TransactionImpl): void;
|
||||
handleEndTransaction(): void;
|
||||
|
@ -170,6 +171,15 @@ export class ConsoleObservableLogger implements IObservableLogger {
|
|||
changedObservables.clear();
|
||||
}
|
||||
|
||||
handleDerivedCleared(derived: Derived<unknown>): void {
|
||||
if (!this._isIncluded(derived)) { return; }
|
||||
|
||||
console.log(...this.textToConsoleArgs([
|
||||
formatKind('derived cleared'),
|
||||
styled(derived.debugName, { color: 'BlueViolet' }),
|
||||
]));
|
||||
}
|
||||
|
||||
handleFromEventObservableTriggered(observable: FromEventObservable<any, any>, info: IChangeInformation): void {
|
||||
if (!this._isIncluded(observable)) { return; }
|
||||
|
||||
|
|
Loading…
Reference in New Issue