fix: properly handle undefined connector id at remote start transaction
[e-mobility-charging-stations-simulator.git] / src / charging-station / broadcast-channel / UIServiceWorkerBroadcastChannel.ts
index 93586ceeee85a927e5fcbbea9f79b70cc2db59d7..ef07b5dac21abda443378f0ad0470b14f0bb4403 100644 (file)
@@ -1,4 +1,3 @@
-import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js'
 import {
   type BroadcastChannelResponse,
   type BroadcastChannelResponsePayload,
@@ -6,8 +5,9 @@ import {
   type ResponsePayload,
   ResponseStatus
 } from '../../types/index.js'
-import { isNullOrUndefined, logger } from '../../utils/index.js'
+import { logger } from '../../utils/index.js'
 import type { AbstractUIService } from '../ui-server/ui-services/AbstractUIService.js'
+import { WorkerBroadcastChannel } from './WorkerBroadcastChannel.js'
 
 const moduleName = 'UIServiceWorkerBroadcastChannel'
 
@@ -78,7 +78,7 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
           }
           return undefined
         })
-        .filter((hashId) => !isNullOrUndefined(hashId)) as string[],
+        .filter(hashId => hashId != null) as string[],
       ...(responsesStatus === ResponseStatus.FAILURE && {
         hashIdsFailed: this.responses
           .get(uuid)
@@ -88,18 +88,18 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
             }
             return undefined
           })
-          .filter((hashId) => !isNullOrUndefined(hashId)) as string[]
+          .filter(hashId => hashId != null) as string[]
       }),
       ...(responsesStatus === ResponseStatus.FAILURE && {
         responsesFailed: this.responses
           .get(uuid)
-          ?.responses.map((response) => {
-            if (response != null && response.status === ResponseStatus.FAILURE) {
+          ?.responses.map(response => {
+            if (response.status === ResponseStatus.FAILURE) {
               return response
             }
             return undefined
           })
-          .filter((response) => !isNullOrUndefined(response)) as BroadcastChannelResponsePayload[]
+          .filter(response => response != null) as BroadcastChannelResponsePayload[]
       })
     }
   }