gui still leaking data

This commit is contained in:
Scott Bell 2024-08-15 16:07:13 -05:00
parent 484a81b370
commit 446c8119c3
2 changed files with 18 additions and 1 deletions

View File

@ -88,6 +88,20 @@ export default class CompsManager extends EventEmitter {
this.#telemetryLoadedPromises = [];
}
startListeningToUnderlyingTelemetry() {
Object.keys(this.#telemetryCollections).forEach((keyString) => {
if (!this.#telemetryCollections[keyString].loaded) {
this.#telemetryCollections[keyString].load();
}
});
}
stopListeningToUnderlyingTelemetry() {
Object.keys(this.#telemetryCollections).forEach((keyString) => {
this.#telemetryCollections[keyString].destroy();
});
}
getTelemetryObjects() {
return this.#telemetryObjects;
}

View File

@ -105,9 +105,12 @@ export default class CompsTelemetryProvider {
specificCompsManager.on('underlyingTelemetryUpdated', (newTelemetry) => {
this.#computeOnNewTelemetry(specificCompsManager, newTelemetry, callbackID);
});
specificCompsManager.startListeningToUnderlyingTelemetry();
return () => {
specificCompsManager.off('calculationUpdated', callback);
specificCompsManager.off('underlyingTelemetryUpdated', callback);
delete this.#subscriptionCallbacks[callbackID];
// if this is the last subscription, tell the comp manager to stop listening
specificCompsManager.stopListeningToUnderlyingTelemetry();
};
}