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;
});
this.updateStyles();
// For some reason, the above updateStyles does not always update the
// styles on first page load, even though it is definitely called after
// the checkboxes are ready. As a hackfix, wait 8ms and then try again.
this.debounce('updateStyles', () => {
this.updateStyles();
}, 8);
// The updateStyles call fails silently if the browser doesn't have focus,
// e.g. if TensorBoard was opened into a new tab that isn't visible.
// As a workaround... we know requestAnimationFrame won't fire until the
// page has focus, so updateStyles again on requestAnimationFrame.
window.requestAnimationFrame(() => this.updateStyles());
},
_checkboxChange: function(e) {
var name = e.srcElement.name;