luci-base: prevent save/traceback race for _state

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 <newtwen+github@gmail.com>
This commit is contained in:
Paul Donald
2026-03-04 01:13:00 +01:00
parent a1ddb07fef
commit daca0e85a8

View 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);
}