Another fix for the all-blue-checkboxes in the run selector.

It was broken if you opened TensorBoard in a new tab (or anything else triggered a page load when the tab didn't have context).
Now we wire the first call to requestAnimationFrame, so it will load when the user views the page.
Change: 122541497
This commit is contained in:
Dan Mané 2016-05-17 09:56:01 -08:00 committed by TensorFlower Gardener
parent f7d81d65f4
commit 050aab10d3

View File

@ -190,12 +190,11 @@ handle these situations gracefully.
p.customStyle['--paper-checkbox-unchecked-ink-color'] = color; p.customStyle['--paper-checkbox-unchecked-ink-color'] = color;
}); });
this.updateStyles(); this.updateStyles();
// For some reason, the above updateStyles does not always update the // The updateStyles call fails silently if the browser doesn't have focus,
// styles on first page load, even though it is definitely called after // e.g. if TensorBoard was opened into a new tab that isn't visible.
// the checkboxes are ready. As a hackfix, wait 8ms and then try again. // As a workaround... we know requestAnimationFrame won't fire until the
this.debounce('updateStyles', () => { // page has focus, so updateStyles again on requestAnimationFrame.
this.updateStyles(); window.requestAnimationFrame(() => this.updateStyles());
}, 8);
}, },
_checkboxChange: function(e) { _checkboxChange: function(e) {
var name = e.srcElement.name; var name = e.srcElement.name;