Skip to content

Commit

Permalink
fix: ensure no null serialized values end in UI server response payload
Browse files Browse the repository at this point in the history
Signed-off-by: Jérôme Benoit <[email protected]>
  • Loading branch information
Jérôme Benoit committed Nov 30, 2023
1 parent f12cf7e commit 31fdd91
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,31 @@ export class UIServiceWorkerBroadcastChannel extends WorkerBroadcastChannel {
status: responsesStatus,
hashIdsSucceeded: this.responses
.get(uuid)
?.responses.filter(({ hashId }) => !isNullOrUndefined(hashId))
.map(({ status, hashId }) => {
if (status === ResponseStatus.SUCCESS) {
?.responses.map(({ status, hashId }) => {
if (hashId !== undefined && status === ResponseStatus.SUCCESS) {
return hashId;
}
}) as string[],
})
.filter((hashId) => !isNullOrUndefined(hashId)) as string[],
...(responsesStatus === ResponseStatus.FAILURE && {
hashIdsFailed: this.responses
.get(uuid)
?.responses.filter(({ hashId }) => !isNullOrUndefined(hashId))
.map(({ status, hashId }) => {
if (status === ResponseStatus.FAILURE) {
?.responses.map(({ status, hashId }) => {
if (hashId !== undefined && status === ResponseStatus.FAILURE) {
return hashId;
}
}) as string[],
})
.filter((hashId) => !isNullOrUndefined(hashId)) as string[],
}),
...(responsesStatus === ResponseStatus.FAILURE && {
responsesFailed: this.responses
.get(uuid)
?.responses.filter((response) => !isNullOrUndefined(response))
.map((response) => {
if (response.status === ResponseStatus.FAILURE) {
?.responses.map((response) => {
if (response !== undefined && response.status === ResponseStatus.FAILURE) {
return response;
}
}) as BroadcastChannelResponsePayload[],
})
.filter((response) => !isNullOrUndefined(response)) as BroadcastChannelResponsePayload[],
}),
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export abstract class AbstractUIService {
if (isNotEmptyArray(payload.hashIds)) {
payload.hashIds = payload.hashIds
?.map((hashId) => {
if (this.uiServer.chargingStations.has(hashId) === true) {
if (hashId !== undefined && this.uiServer.chargingStations.has(hashId) === true) {
return hashId;
}
const msg = `${this.logPrefix(
Expand Down

0 comments on commit 31fdd91

Please sign in to comment.