Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@
type: Function,
value: () => getRouter().pluginRunTagRoute('scalars', '/scalars'),
},

/*
* A map such that `_loadedRuns[run] === true` iff we've loaded
* `run` already, or are in the process of loading it. This
* exists so that when there are 100 runs selected and the user
* selects an additional run, we only fetch 1 more run instead
* of 101.
*
* `reload` clears this cache.
*
* Equivalently, this is the set of runs for which, after
* callbacks in-flight resolve, the most recent call to
* `setSeriesData(run, data)` on the chart object (a) exists
* and (b) occurred after all reloads so far.
*/
_loadedRuns: {
type: Object,
value: () => ({}),
},
},
observers: [
'reload(tag)',
Expand All @@ -188,6 +207,10 @@
this._changeSeries();
},
reload() {
this._loadedRuns = {};
this._loadData();
},
_loadData() {
if (!this._attached) {
return;
}
Expand All @@ -196,6 +219,10 @@
// prevent race conditions where older data stomps newer data.
this._canceller.cancelAll();
this.runs.forEach(run => {
if (this._loadedRuns[run]) {
return;
}
this._loadedRuns[run] = true;
const url = this._scalarUrl(this.tag, run);
const updateSeries = this._canceller.cancellable(result => {
if (result.cancelled) {
Expand All @@ -214,7 +241,7 @@
},
_changeSeries() {
this.$$('vz-line-chart').setVisibleSeries(this.runs);
this.reload();
this._loadData();
},
redraw() {
this.$$('vz-line-chart').redraw();
Expand Down