Summary widget unsubscribe (#2364)

* Delete subscription handle to prevent double unsubscribe error

* Do not attempt to render undefined telemetry datum
This commit is contained in:
Andrew Henry
2019-04-08 22:02:40 -07:00
committed by Deep Tailor
parent b7fa5c7ba8
commit 40d54df567
3 changed files with 6 additions and 2 deletions

View File

@ -237,6 +237,7 @@ define ([
}); });
delete this.compositionObjs[objectId]; delete this.compositionObjs[objectId];
this.subscriptions[objectId](); //unsubscribe from telemetry source this.subscriptions[objectId](); //unsubscribe from telemetry source
delete this.subscriptions[objectId];
this.eventEmitter.emit('remove', identifier); this.eventEmitter.emit('remove', identifier);
if (_.isEmpty(this.compositionObjs)) { if (_.isEmpty(this.compositionObjs)) {

View File

@ -43,7 +43,7 @@ define([
return evaluator.requestLatest(options) return evaluator.requestLatest(options)
.then(function (latestDatum) { .then(function (latestDatum) {
this.pool.release(evaluator); this.pool.release(evaluator);
return [latestDatum]; return latestDatum ? [latestDatum] : [];
}.bind(this)); }.bind(this));
}; };

View File

@ -52,7 +52,10 @@ define([
strategy: 'latest', strategy: 'latest',
size: 1 size: 1
}).then(function (results) { }).then(function (results) {
if (this.destroyed || this.hasUpdated || this.renderTracker !== renderTracker) { if (this.destroyed ||
this.hasUpdated ||
this.renderTracker !== renderTracker ||
results.length === 0) {
return; return;
} }
this.updateState(results[results.length - 1]); this.updateState(results[results.length - 1]);