# HG changeset patch # User Edouard Tisserant # Date 1616472919 -3600 # Node ID f1049e4df86604dcca4d12fba656d728607a1a8d # Parent 490fbf870f42b5a091e4a2b1b364050ec69afde4# Parent cdd2a032b424ccf72abf2fbb9273f9abfd48dfc8 Merged diff -r 490fbf870f42 -r f1049e4df866 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Tue Mar 23 05:13:18 2021 +0100 +++ b/svghmi/gen_index_xhtml.xslt Tue Mar 23 05:15:19 2021 +0100 @@ -4607,49 +4607,55 @@ this.abort_controller = new AbortController(); - const query = { - - args: this.args, - - range: this.cache[1], - - position: this.cache[2], - - visible: this.visible, - - extra: this.cache.slice(4), - - options: opt - - }; - - - - const options = { - - method: 'POST', - - body: JSON.stringify(query), - - headers: {'Content-Type': 'application/json'}, - - signal: this.abort_controller.signal - - }; - - - - return fetch(this.args[0], options) - - .then(this.handle_http_response_bound) - - .then(this.spread_json_data_bound) - - .catch(this.fetch_error_bound); - - - - } + return Promise.resolve().then(() => { + + + + const query = { + + args: this.args, + + range: this.cache[1], + + position: this.cache[2], + + visible: this.visible, + + extra: this.cache.slice(4), + + options: opt + + }; + + + + const options = { + + method: 'POST', + + body: JSON.stringify(query), + + headers: {'Content-Type': 'application/json'}, + + signal: this.abort_controller.signal + + }; + + + + return fetch(this.args[0], options) + + .then(this.handle_http_response_bound) + + .then(this.spread_json_data_bound) + + .catch(this.fetch_error_bound); + + }); + + } + + unsub(){ diff -r 490fbf870f42 -r f1049e4df866 svghmi/widget_jsontable.ysl2 --- a/svghmi/widget_jsontable.ysl2 Tue Mar 23 05:13:18 2021 +0100 +++ b/svghmi/widget_jsontable.ysl2 Tue Mar 23 05:15:19 2021 +0100 @@ -25,28 +25,31 @@ do_http_request(...opt) { this.abort_controller = new AbortController(); - const query = { - args: this.args, - range: this.cache[1], - position: this.cache[2], - visible: this.visible, - extra: this.cache.slice(4), - options: opt - }; - - const options = { - method: 'POST', - body: JSON.stringify(query), - headers: {'Content-Type': 'application/json'}, - signal: this.abort_controller.signal - }; - - return fetch(this.args[0], options) - .then(this.handle_http_response_bound) - .then(this.spread_json_data_bound) - .catch(this.fetch_error_bound); - - } + return Promise.resolve().then(() => { + + const query = { + args: this.args, + range: this.cache[1], + position: this.cache[2], + visible: this.visible, + extra: this.cache.slice(4), + options: opt + }; + + const options = { + method: 'POST', + body: JSON.stringify(query), + headers: {'Content-Type': 'application/json'}, + signal: this.abort_controller.signal + }; + + return fetch(this.args[0], options) + .then(this.handle_http_response_bound) + .then(this.spread_json_data_bound) + .catch(this.fetch_error_bound); + }); + } + unsub(){ this.abort_controller.abort(); super.unsub();