From: Jérôme Benoit Date: Wed, 25 Mar 2026 21:20:43 +0000 (+0100) Subject: fix: post updated message on connectorStatusChanged to fix stale UI cache X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7337563a60ab9b6172afca92b64fbc485e85e18f;p=e-mobility-charging-stations-simulator.git fix: post updated message on connectorStatusChanged to fix stale UI cache The .finally() in internalSendMessage emits the updated event BEFORE sendAndSetConnectorStatus updates connectorStatus.status, causing the UI cache to snapshot the old status. The connectorStatusChanged event fires AFTER the update, so posting an updated message on it ensures the cache receives the correct connector status. --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 33d20155..68beff82 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -251,6 +251,9 @@ export class ChargingStation extends EventEmitter { this.on(ChargingStationEvents.updated, () => { parentPort?.postMessage(buildUpdatedMessage(this)) }) + this.on(ChargingStationEvents.connectorStatusChanged, () => { + parentPort?.postMessage(buildUpdatedMessage(this)) + }) this.on(ChargingStationEvents.accepted, () => { this.startMessageSequence( this.wsConnectionRetryCount > 0