luci-base: load luci preferences early
authorPaul Donald <newtwen+github@gmail.com>
Tue, 3 Feb 2026 19:30:37 +0000 (20:30 +0100)
committerPaul Donald <newtwen+github@gmail.com>
Tue, 3 Feb 2026 19:30:37 +0000 (20:30 +0100)
Follow-up to 315dbfc7498e2f43afb0119b992915e8f311bc37

In order to look at any saved uci value, the luci config
must be loaded before we render the page, so we can determine
stored preferences, for things like table filter, without
encumbering all consumers of configurable elements to load
the luci uci configuration.

All (Table) elements extend CBIAbstractElement, so load
there.

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
modules/luci-base/htdocs/luci-static/resources/form.js
modules/luci-base/root/usr/share/rpcd/acl.d/luci-base.json

index b2f308fc5191564a894e58bc3b60aa40116f90d6..084fa353e75e4417a0089059e69ad413f280589d 100644 (file)
@@ -378,6 +378,7 @@ const CBIAbstractElement = baseclass.extend(/** @lends LuCI.form.AbstractElement
 const CBIMap = CBIAbstractElement.extend(/** @lends LuCI.form.Map.prototype */ {
        __init__(config, ...args) {
                this.super('__init__', args);
+               uci.load('luci');
 
                this.config = config;
                this.parsechain = [ config ];
@@ -2740,7 +2741,7 @@ const CBITableSection = CBITypedSection.extend(/** @lends LuCI.form.TableSection
                const max_cols = this.max_cols ?? this.children.length;
                const has_more = max_cols < this.children.length;
                const anon_class = (!this.anonymous || this.sectiontitle) ? 'named' : 'anonymous';
-               const tableFilter = this.map.data.get('luci', 'main', 'tablefilters') || false;
+               const tableFilter = uci.get('luci', 'main', 'tablefilters') || false;
                const trEls = E([]);
 
                for (let i = 0, opt; i < max_cols && (opt = this.children[i]) != null; i++) {
index cc7f06b3f07f58221dfdaddf373ceec13984b84b..c043c05b9d8b5273e52f95231f583573a34089ce 100644 (file)
@@ -19,7 +19,7 @@
                                "file": [ "list" ],
                                "uci": [ "changes", "get" ]
                        },
-                       "uci": [ "system" ]
+                       "uci": [ "system", "luci" ]
                },
                "write": {
                        "cgi-io": [ "upload" ],