luci-base: form.js: allow secondary configs to fail loading
authorJo-Philipp Wich <jo@mein.io>
Tue, 28 Apr 2020 07:46:22 +0000 (09:46 +0200)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:49 +0000 (19:40 +0200)
Ref: https://forum.openwrt.org/t/luci-rpc-error/61760
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(backported from commit 17ffc84a2903c2354543cd0fb575a82e36e076fd)

modules/luci-base/htdocs/luci-static/resources/form.js

index 01c9ba8cdf7f93e6c0d1d89f32bc3567ac981ac5..c1331fb34593e220a4efda01cebc27f1b81ca485 100644 (file)
@@ -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));
        },
 
        /**