From: Jo-Philipp Wich Date: Tue, 28 Apr 2020 07:46:22 +0000 (+0200) Subject: luci-base: form.js: allow secondary configs to fail loading X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=561de16a5d889a91142c38e3ea18f1803252f0a9;p=oweals%2Fluci.git luci-base: form.js: allow secondary configs to fail loading Ref: https://forum.openwrt.org/t/luci-rpc-error/61760 Signed-off-by: Jo-Philipp Wich (backported from commit 17ffc84a2903c2354543cd0fb575a82e36e076fd) --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 01c9ba8cd..c1331fb34 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -520,8 +520,16 @@ var CBIMap = CBIAbstractElement.extend(/** @lends LuCI.form.Map.prototype */ { * an error. */ load: function() { - return this.data.load(this.parsechain || [ this.config ]) - .then(this.loadChildren.bind(this)); + var loadTasks = [], + configs = this.parsechain || [ this.config ]; + + loadTasks.push.apply(loadTasks, configs.map(L.bind(function(config, i) { + return i ? L.resolveDefault(this.data.load(config)) : this.data.load(config); + }, this))); + + return Promise.all(loadTasks).then(L.bind(function(res) { + return this.loadChildren(); + }, this)); }, /**