From 1035ff31ec861b3acb991df278b60022ea3d50b7 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 14 Jun 2021 14:15:58 +0200 Subject: [PATCH] fix async loading caused et2 widgets calling api before loaded using a strict order now: 1. legacy stuff like jquery and dhtmlx 2. client-side api / egw-object 3. et2 and rest --- api/js/jsapi/egw.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/js/jsapi/egw.js b/api/js/jsapi/egw.js index 4172a70834..4284a61746 100644 --- a/api/js/jsapi/egw.js +++ b/api/js/jsapi/egw.js @@ -206,12 +206,19 @@ window.app = {classes: {}}; })); } + const egw_modules = [ + 'egw_core', 'egw_debug', 'egw_preferences', 'egw_lang', 'egw_links', 'egw_open', 'egw_user', + 'egw_config', 'egw_images', 'egw_jsonq', 'egw_files', 'egw_json', 'egw_store', 'egw_tooltip', 'egw_css', + 'egw_calendar', 'egw_ready', 'egw_data', 'egw_tail', 'egw_message', 'egw_notification' + ]; // make our promise global, as legacy code calls egw_LAB.wait which we assign to egw_ready.then window.egw_LAB = window.egw_ready = legacy_js_import(include.filter((src) => src.match(legacy_js_regexp) !== null), window.egw_webserverUrl) - .then(() => Promise.all(include.filter((src) => src.match(legacy_js_regexp) === null) + .then(Promise.all(egw_modules.map(mod => import(window.egw_webserverUrl+'/api/js/jsapi/'+mod+'.js') + .catch((err) => {console.log(rel_src+":\n\n"+err.message)})))) + .then(() => Promise.all(include.filter((src) => src.match(legacy_js_regexp) === null) //.reverse() .map(rel_src => import(window.egw_webserverUrl+'/'+rel_src) - .catch((err) => { console.log(rel_src+":\n\n"+err.message)}) + .catch((err) => {console.log(rel_src+":\n\n"+err.message)}) ))).then(() => { // We need to override the globalEval to mitigate potential execution of