Skip to content

Commit daca0e8

Browse files
committed
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>
1 parent a1ddb07 commit daca0e8

File tree

1 file changed

+3
-1
lines changed
  • modules/luci-base/htdocs/luci-static/resources

1 file changed

+3
-1
lines changed

modules/luci-base/htdocs/luci-static/resources/network.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ function initNetworkState(refresh) {
354354
if (_state == null || refresh) {
355355
const hasWifi = L.hasSystemFeature('wifi');
356356

357-
if (refresh) _state = null;
358357
if (refresh || !_init) {
359358
_init = Promise.all([
360359
L.resolveDefault(callNetworkInterfaceDump(), []),
@@ -538,6 +537,9 @@ function initNetworkState(refresh) {
538537

539538
}
540539

540+
if (refresh)
541+
return _init;
542+
541543
return (_state != null ? Promise.resolve(_state) : _init);
542544
}
543545

0 commit comments

Comments
 (0)