]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commit
fix: stop nullifying wsConnection prematurely in close/terminate main
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:41:49 +0000 (23:41 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 2 May 2026 21:41:49 +0000 (23:41 +0200)
commitb8ba9459c73b25fa93251c2a97d1aa72a88f0185
tree13b0a3698f8ec8f4f3eed6d670656e6232558b8e
parentf9acca43755ddb79c21d1c05a74b0c02f3059da3
fix: stop nullifying wsConnection prematurely in close/terminate

closeWSConnection() and terminateWSConnection() set wsConnection to null
immediately after calling close()/terminate(), but the 'close' event
fires asynchronously afterward. The onClose handler then emitted an
'updated' event with wsState undefined (since wsConnection was null),
causing the UI to display 'ws unknown' instead of 'ws closed'.

Remove the null assignments — the stale WebSocket reference is harmless
(overwritten by the next openWSConnection call) and allows onClose to
read the correct readyState (CLOSED=3) when emitting state updates.
src/charging-station/ChargingStation.ts
ui/web/tests/unit/skins/modern/ConnectorRow.test.ts
ui/web/tests/unit/skins/modern/ModernLayout.test.ts
ui/web/tests/unit/skins/modern/StationCard.test.ts