From 3b1ce22b71dc72e985b8c0f288c4100a57eb0899 Mon Sep 17 00:00:00 2001 From: Robin Date: Wed, 25 Jun 2025 13:38:47 -0400 Subject: [PATCH] Fold map operation into combineLatest --- src/state/MediaDevices.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/state/MediaDevices.ts b/src/state/MediaDevices.ts index 08b367a3..4e41a463 100644 --- a/src/state/MediaDevices.ts +++ b/src/state/MediaDevices.ts @@ -269,21 +269,21 @@ class ControlledAudioOutput this.deviceSelection$.next(id); } - public readonly selected$ = combineLatest([ - this.available$, - merge( - controlledOutputSelection$.pipe(startWith(undefined)), - this.deviceSelection$, - ), - ]).pipe( - map(([available, selectId]) => { + public readonly selected$ = combineLatest( + [ + this.available$, + merge( + controlledOutputSelection$.pipe(startWith(undefined)), + this.deviceSelection$, + ), + ], + (available, selectId) => { const id = selectId ?? available.keys().next().value; return id ? { id, virtualEarpiece: id === EARPIECE_CONFIG_ID } : undefined; - }), - this.scope.state(), - ); + }, + ).pipe(this.scope.state()); public constructor(private readonly scope: ObservableScope) { this.selected$.subscribe((device) => {