From: Andy Chiang Date: Tue, 19 May 2026 16:29:07 +0000 (+0700) Subject: luci-base: fix uci write bug when input value equals default X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=974b5864e05ef30f38149389f15583c08bdd4eda;p=openwrt-luci.git luci-base: fix uci write bug when input value equals default Avoid executing unnecessary write operations to flash/UCI when the user's form selection or input exactly matches the component's `default` configuration. Previously, if a field had a valid value identical to its default, it would bypass the empty check and trigger a `write()` call, leading to configuration bloating. This change ensures that such values are correctly intercepted and handled via `this.remove()` to keep the underlying configuration file clean and precise. Signed-off-by: Andy Chiang --- diff --git a/modules/luci-base/htdocs/luci-static/resources/form.js b/modules/luci-base/htdocs/luci-static/resources/form.js index 6f14678de1..7e11d9299f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/form.js +++ b/modules/luci-base/htdocs/luci-static/resources/form.js @@ -2149,7 +2149,7 @@ const CBIAbstractValue = CBIAbstractElement.extend(/** @lends LuCI.form.Abstract const cval = this.cfgvalue(section_id); const fval = this.formvalue(section_id); - if (fval == null || fval == '') { + if (fval == null || fval == '' || (fval == this.default && (this.optional || this.rmempty))) { if (this.rmempty || this.optional) { return Promise.resolve(this.remove(section_id)); }