From f2a49104c4839cc61c0c6a32cf0b616ca7b7d667 Mon Sep 17 00:00:00 2001 From: Hannu Nyman Date: Sun, 17 Mar 2024 09:17:20 +0200 Subject: [PATCH] Revert "luci-base: force menu to regenerate after uci change" This reverts commit 97ebdcbddb9cad76dc551086fcb887e55886a069. The commit seems to cause errors already before the login screen. Discussion in https://github.com/openwrt/luci/commit/97ebdcbddb9cad76dc551086fcb887e55886a069#commitcomment-139871175 Errors like: In error(), file [C] called from function [anonymous function] (/usr/lib/lua/luci/ucodebridge.lua:23) called from function ((tail call)) In [anonymous function](), file /usr/share/ucode/luci/runtime.uc, line 148, byte 45: called from function build_pagetree (/usr/share/ucode/luci/dispatcher.uc:382:73) called from function menu_json (/usr/share/ucode/luci/dispatcher.uc:439:26) called from function [anonymous function] (/usr/share/ucode/luci/dispatcher.uc:898:24) called from anonymous function (/www/cgi-bin/luci:39:13) ` return lcall.call(modname, method, ...args);` Near here ----------------------------------------^ Signed-off-by: Hannu Nyman --- modules/luci-base/htdocs/luci-static/resources/uci.js | 2 -- modules/luci-base/htdocs/luci-static/resources/ui.js | 4 ---- modules/luci-base/ucode/dispatcher.uc | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/modules/luci-base/htdocs/luci-static/resources/uci.js b/modules/luci-base/htdocs/luci-static/resources/uci.js index c56ce4016a24..76b274470b19 100644 --- a/modules/luci-base/htdocs/luci-static/resources/uci.js +++ b/modules/luci-base/htdocs/luci-static/resources/uci.js @@ -919,8 +919,6 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ { window.setTimeout(try_confirm, 250); else return Promise.reject(rv); - } else { - document.dispatchEvent(new CustomEvent('uci-applied')); } return rv; diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index b17fdc45fe1e..afb590d8f8a5 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -3478,10 +3478,6 @@ var UITable = baseclass.extend(/** @lends LuCI.ui.table.prototype */ { } }); -// Because the menu can depend on uci values, we need to flush the cache -// after uci mutations. -document.addEventListener('uci-applied', () => UIMenu.flushCache()); - /** * @class ui * @memberof LuCI diff --git a/modules/luci-base/ucode/dispatcher.uc b/modules/luci-base/ucode/dispatcher.uc index 694891a90e6a..8717385be217 100644 --- a/modules/luci-base/ucode/dispatcher.uc +++ b/modules/luci-base/ucode/dispatcher.uc @@ -358,7 +358,7 @@ function build_pagetree() { firstchild_ineligible: 'bool' }; - let files = glob('/usr/share/luci/menu.d/*.json', '/etc/config/*', '/usr/lib/lua/luci/controller/*.lua', '/usr/lib/lua/luci/controller/*/*.lua'); + let files = glob('/usr/share/luci/menu.d/*.json', '/usr/lib/lua/luci/controller/*.lua', '/usr/lib/lua/luci/controller/*/*.lua'); let cachefile; if (indexcache) {