luci-base: prevent save/traceback race for _state
authorPaul Donald <redacted>
Wed, 4 Mar 2026 00:13:00 +0000 (01:13 +0100)
committerPaul Donald <redacted>
Wed, 4 Mar 2026 00:13:05 +0000 (01:13 +0100)
A _state race is possible during save when a refresh is in
progress. Attempt to avoid it by not nulling state prior
to refresh.

Signed-off-by: Paul Donald <redacted>
modules/luci-base/htdocs/luci-static/resources/network.js

index 6d84f12a5ffe6400dc3ae3037ed1d4cd73bf7e5a..67ed3bf522afb00a1e99a439b04225ca6ab16878 100644 (file)
@@ -354,7 +354,6 @@ function initNetworkState(refresh) {
        if (_state == null || refresh) {
                const hasWifi = L.hasSystemFeature('wifi');
 
-               if (refresh) _state = null;
                if (refresh || !_init) {
                        _init = Promise.all([
                        L.resolveDefault(callNetworkInterfaceDump(), []),
@@ -538,6 +537,9 @@ function initNetworkState(refresh) {
 
        }
 
+       if (refresh)
+               return _init;
+
        return (_state != null ? Promise.resolve(_state) : _init);
 }
 
git clone https://git.99rst.org/PROJECT