From e38c04b3b184f5bbf65205b3bd7ad40b313f9795 Mon Sep 17 00:00:00 2001 From: Timo K Date: Fri, 19 Sep 2025 17:16:09 +0200 Subject: [PATCH] fix ci Signed-off-by: Timo K --- src/room/InCallView.tsx | 14 ++++++++++---- src/state/CallViewModel.test.ts | 6 ++++-- src/utils/test-viewmodel.ts | 3 ++- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 348a2c44..6cdbb75c 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -125,6 +125,7 @@ import { prefetchSounds } from "../soundUtils"; import { useAudioContext } from "../useAudioContext"; import ringtoneMp3 from "../sound/ringtone.mp3?url"; import ringtoneOgg from "../sound/ringtone.ogg?url"; +import { ObservableScope } from "../state/ObservableScope.ts"; const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); @@ -144,8 +145,13 @@ export const ActiveCall: FC = (props) => { sfuConfig, props.e2eeSystem, ); - const connStateObservable$ = useObservable( - (inputs$) => inputs$.pipe(map(([connState]) => connState)), + const observableScope = useInitial(() => new ObservableScope()); + const connStateBehavior$ = useObservable( + (inputs$) => + observableScope.behavior( + inputs$.pipe(map(([connState]) => connState)), + connState, + ), [connState], ); const [vm, setVm] = useState(null); @@ -188,7 +194,7 @@ export const ActiveCall: FC = (props) => { waitForCallPickup: waitForCallPickup && sendNotificationType === "ring", }, - connStateObservable$, + connStateBehavior$, reactionsReader.raisedHands$, reactionsReader.reactions$, ); @@ -204,7 +210,7 @@ export const ActiveCall: FC = (props) => { livekitRoom, mediaDevices, props.e2eeSystem, - connStateObservable$, + connStateBehavior$, autoLeaveWhenOthersLeft, sendNotificationType, waitForCallPickup, diff --git a/src/state/CallViewModel.test.ts b/src/state/CallViewModel.test.ts index 7bfb4a82..3266c67a 100644 --- a/src/state/CallViewModel.test.ts +++ b/src/state/CallViewModel.test.ts @@ -266,7 +266,7 @@ const mockLegacyRingEvent = {} as { event_id: string } & ICallNotifyContent; interface CallViewModelInputs { remoteParticipants$: Behavior; rtcMembers$: Behavior[]>; - livekitConnectionState$: Observable; + livekitConnectionState$: Behavior; speaking: Map>; mediaDevices: MediaDevices; initialSyncState: SyncState; @@ -276,7 +276,9 @@ function withCallViewModel( { remoteParticipants$ = constant([]), rtcMembers$ = constant([localRtcMember]), - livekitConnectionState$: connectionState$ = of(ConnectionState.Connected), + livekitConnectionState$: connectionState$ = constant( + ConnectionState.Connected, + ), speaking = new Map(), mediaDevices = mockMediaDevices({}), initialSyncState = SyncState.Syncing, diff --git a/src/utils/test-viewmodel.ts b/src/utils/test-viewmodel.ts index 09044e3f..687adba7 100644 --- a/src/utils/test-viewmodel.ts +++ b/src/utils/test-viewmodel.ts @@ -39,6 +39,7 @@ import { localRtcMember, } from "./test-fixtures"; import { type RaisedHandInfo, type ReactionInfo } from "../reactions"; +import { constant } from "../state/Behavior"; export function getBasicRTCSession( members: RoomMember[], @@ -154,7 +155,7 @@ export function getBasicCallViewModelEnvironment( encryptionSystem: { kind: E2eeType.PER_PARTICIPANT }, ...callViewModelOptions, }, - of(ConnectionState.Connected), + constant(ConnectionState.Connected), handRaisedSubject$, reactionsSubject$, );