widgets: fix Traffic.js initialization race condition (#10099)

This commit is contained in:
Greelan 2026-04-08 17:11:34 +10:00 committed by GitHub
parent 477451d9b7
commit 8b5a768ec7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -32,7 +32,7 @@ export default class Traffic extends BaseWidget {
trafficIn: null,
trafficOut: null
};
this.initialized = false;
this.initialized = null;
this.datasets = {inbytes: [], outbytes: []};
this.configurable = true;
this.configChanged = false;
@ -160,9 +160,9 @@ export default class Traffic extends BaseWidget {
const data = JSON.parse(event.data);
if (!this.initialized) {
await this._initialize(data);
this.initialized = true;
this.initialized = this._initialize(data);
}
await this.initialized;
let config = null;
if (this.configChanged) {