From 6feb9f468afa7de85634681b5079a0d45ea84026 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 22 Apr 2022 10:52:16 -0600 Subject: [PATCH] Handle missing nextmatch controller when setting up auto-refresh by trying again later. (Missing controller caused by new template loading) --- api/js/etemplate/et2_extension_nextmatch.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/js/etemplate/et2_extension_nextmatch.ts b/api/js/etemplate/et2_extension_nextmatch.ts index 471550e1ec..1af11f80d1 100644 --- a/api/js/etemplate/et2_extension_nextmatch.ts +++ b/api/js/etemplate/et2_extension_nextmatch.ts @@ -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