diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 9f3b88302a..4925c03434 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1899,16 +1899,14 @@ DOM.content(vp, E('div', { 'class': 'spinning' }, _('Loading view…'))); - return Promise.resolve(this.load()) - .then(function (...args) { - if (L.loaded) { - return Promise.resolve(...args); - } else { - return new Promise(function (resolve) { - document.addEventListener('luci-loaded', resolve.bind(null, ...args), { once: true }); - }); - } - }) + const ready = L.loaded + ? Promise.resolve() + : new Promise((resolve) => { + document.addEventListener('luci-loaded', resolve, { once: true }); + }); + + return ready + .then(LuCI.prototype.bind(this.load, this)) .then(LuCI.prototype.bind(this.render, this)) .then(LuCI.prototype.bind(function(nodes) { const vp = document.getElementById('view');