diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index a1207f567c..1a5eaa296c 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1893,6 +1893,15 @@ 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 }); + }); + } + }) .then(LuCI.prototype.bind(this.render, this)) .then(LuCI.prototype.bind(function(nodes) { const vp = document.getElementById('view'); @@ -2688,9 +2697,12 @@ initDOM() { originalCBIInit(); Poll.start(); + L.loaded = true; document.dispatchEvent(new CustomEvent('luci-loaded')); }, + loaded: false, + /** * The `env` object holds environment settings used by LuCI, such * as request timeouts, base URLs etc.