Handle missing nextmatch controller when setting up auto-refresh by trying again later.

(Missing controller caused by new template loading)
This commit is contained in:
nathan 2022-04-22 10:52:16 -06:00
parent f18dd19536
commit 6feb9f468a

View File

@ -2348,6 +2348,12 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
}
if(time > 0)
{
if(!this.controller)
{
// Controller is not ready yet, come back later
setTimeout(() => {this._set_autorefresh(time)}, 1000);
return;
}
this._autorefresh_timer = setInterval(jQuery.proxy(this.controller.update, this.controller), time * 1000);
// Bind to tab show/hide events, so that we don't bother refreshing in the background