-import type { AbstractUIService } from './internal';
-import { WorkerBroadcastChannel } from './WorkerBroadcastChannel';
+import { type AbstractUIService, WorkerBroadcastChannel } from './internal';
import {
type BroadcastChannelResponse,
type BroadcastChannelResponsePayload,
type ResponsePayload,
ResponseStatus,
} from '../types';
-import { logger } from '../utils/Logger';
+import { Utils, logger } from '../utils';
const moduleName = 'UIServiceWorkerBroadcastChannel';
status: responsesStatus,
hashIdsSucceeded: this.responses
.get(uuid)
- ?.responses.map(({ status, hashId }) => {
+ ?.responses.filter(({ hashId }) => !Utils.isNullOrUndefined(hashId))
+ .map(({ status, hashId }) => {
if (status === ResponseStatus.SUCCESS) {
return hashId;
}
- })
- .filter((hashId) => hashId !== undefined),
+ }),
...(responsesStatus === ResponseStatus.FAILURE && {
hashIdsFailed: this.responses
.get(uuid)
- ?.responses.map(({ status, hashId }) => {
+ ?.responses.filter(({ hashId }) => !Utils.isNullOrUndefined(hashId))
+ .map(({ status, hashId }) => {
if (status === ResponseStatus.FAILURE) {
return hashId;
}
- })
- .filter((hashId) => hashId !== undefined),
+ }),
}),
...(responsesStatus === ResponseStatus.FAILURE && {
responsesFailed: this.responses
.get(uuid)
- ?.responses.map((response) => {
+ ?.responses.filter((response) => !Utils.isNullOrUndefined(response))
+ .map((response) => {
if (response.status === ResponseStatus.FAILURE) {
return response;
}
- })
- .filter((response) => response !== undefined),
+ }),
}),
};
}