Replace generateKeyed$ with a redesigned generateItems operator

And use it to clean up a number of code smells, fix some reactivity bugs, and avoid some resource leaks.
This commit is contained in:
Robin
2025-11-07 17:36:16 -05:00
parent 1f386a1d57
commit b4c17ed26d
18 changed files with 610 additions and 441 deletions

View File

@@ -304,18 +304,20 @@ export function createLocalMedia(
localParticipant: LocalParticipant,
mediaDevices: MediaDevices,
): LocalUserMediaViewModel {
const member = mockMatrixRoomMember(localRtcMember, roomMember);
return new LocalUserMediaViewModel(
testScope(),
"local",
mockMatrixRoomMember(localRtcMember, roomMember),
member.userId,
constant(localParticipant),
{
kind: E2eeType.PER_PARTICIPANT,
},
mockLivekitRoom({ localParticipant }),
"https://rtc-example.org",
constant(mockLivekitRoom({ localParticipant })),
constant("https://rtc-example.org"),
mediaDevices,
constant(roomMember.rawDisplayName ?? "nodisplayname"),
constant(member.rawDisplayName ?? "nodisplayname"),
constant(member.getMxcAvatarUrl()),
constant(null),
constant(null),
);
@@ -339,19 +341,23 @@ export function createRemoteMedia(
roomMember: Partial<RoomMember>,
participant: Partial<RemoteParticipant>,
): RemoteUserMediaViewModel {
const member = mockMatrixRoomMember(localRtcMember, roomMember);
const remoteParticipant = mockRemoteParticipant(participant);
return new RemoteUserMediaViewModel(
testScope(),
"remote",
mockMatrixRoomMember(localRtcMember, roomMember),
member.userId,
of(remoteParticipant),
{
kind: E2eeType.PER_PARTICIPANT,
},
mockLivekitRoom({}, { remoteParticipants$: of([remoteParticipant]) }),
"https://rtc-example.org",
constant(
mockLivekitRoom({}, { remoteParticipants$: of([remoteParticipant]) }),
),
constant("https://rtc-example.org"),
constant(false),
constant(roomMember.rawDisplayName ?? "nodisplayname"),
constant(member.rawDisplayName ?? "nodisplayname"),
constant(member.getMxcAvatarUrl()),
constant(null),
constant(null),
);