When using components with resize events (most notably DataTable) an error is thrown if you navigate away from the tab and have some form of 'interval' to reload the data (i.e. re-render the component):
Uncaught TypeError: Cannot read property 'firstElementChild' of undefined
at resetTriggers (hexagon-1.9.0.js:7213)
at HTMLDivElement.scrollListener (hexagon-1.9.0.js:7229)
This also appears to affect Plot so
Possible Fix
Prevent the resize event from firing (or attempting to fire) when the window is inactive
e.g. using something like:
(function() {
var time = 10000,
delta = 100,
tid;
tid = setInterval(function() {
if ( window.blurred ) { return; }
time -= delta;
if ( time <= 0 ) {
clearInterval(tid);
myFunction(); // time passed - do your work
}
}, delta);
})();
window.onblur = function() { window.blurred = true; };
window.onfocus = function() { window.blurred = false; };
Steps to Reproduce
Create a data table that refreshes using setTimeout or setInterval
Navigate to another tab/window and leave the table running in the background
Return to the page and look at the console, it will be full of errors
Context
When using components with resize events (most notably DataTable) an error is thrown if you navigate away from the tab and have some form of 'interval' to reload the data (i.e. re-render the component):
This also appears to affect Plot so
Possible Fix
Prevent the resize event from firing (or attempting to fire) when the window is inactive
e.g. using something like:
Steps to Reproduce
setTimeout
orsetInterval