Use the initialValue parameter of 'behavior' instead of startWith
This commit is contained in:
@@ -403,7 +403,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
*/
|
*/
|
||||||
private readonly rawRemoteParticipants$ = this.scope.behavior<
|
private readonly rawRemoteParticipants$ = this.scope.behavior<
|
||||||
RemoteParticipant[]
|
RemoteParticipant[]
|
||||||
>(connectedParticipantsObserver(this.livekitRoom).pipe(startWith([])));
|
>(connectedParticipantsObserver(this.livekitRoom), []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists of RemoteParticipants to "hold" on display, even if LiveKit claims that
|
* Lists of RemoteParticipants to "hold" on display, even if LiveKit claims that
|
||||||
@@ -889,9 +889,7 @@ export class CallViewModel extends ViewModel {
|
|||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
);
|
);
|
||||||
|
|
||||||
private readonly pipEnabled$: Observable<boolean> = setPipEnabled$.pipe(
|
private readonly pipEnabled$ = this.scope.behavior(setPipEnabled$, false);
|
||||||
startWith(false),
|
|
||||||
);
|
|
||||||
|
|
||||||
private readonly naturalWindowMode$ = this.scope.behavior<WindowMode>(
|
private readonly naturalWindowMode$ = this.scope.behavior<WindowMode>(
|
||||||
fromEvent(window, "resize").pipe(
|
fromEvent(window, "resize").pipe(
|
||||||
|
|||||||
@@ -122,8 +122,8 @@ function availableRawDevices$(
|
|||||||
)
|
)
|
||||||
: devices$,
|
: devices$,
|
||||||
),
|
),
|
||||||
startWith([]),
|
|
||||||
),
|
),
|
||||||
|
[],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -373,10 +373,8 @@ export class MediaDevices {
|
|||||||
// API. This flag never resets to false, because once permissions are granted
|
// API. This flag never resets to false, because once permissions are granted
|
||||||
// the first time, the user won't be prompted again until reload of the page.
|
// the first time, the user won't be prompted again until reload of the page.
|
||||||
private readonly usingNames$ = this.scope.behavior(
|
private readonly usingNames$ = this.scope.behavior(
|
||||||
this.deviceNamesRequest$.pipe(
|
this.deviceNamesRequest$.pipe(map(() => true)),
|
||||||
map(() => true),
|
false,
|
||||||
startWith(false),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
public readonly audioInput: MediaDevice<
|
public readonly audioInput: MediaDevice<
|
||||||
DeviceLabel,
|
DeviceLabel,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ Copyright 2023, 2024 New Vector Ltd.
|
|||||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
import { map, type Observable, of, type SchedulerLike, startWith } from "rxjs";
|
import { map, type Observable, of, type SchedulerLike } from "rxjs";
|
||||||
import { type RunHelpers, TestScheduler } from "rxjs/testing";
|
import { type RunHelpers, TestScheduler } from "rxjs/testing";
|
||||||
import { expect, vi, vitest } from "vitest";
|
import { expect, vi, vitest } from "vitest";
|
||||||
import {
|
import {
|
||||||
@@ -125,9 +125,12 @@ export function withTestScheduler(
|
|||||||
values === undefined ? (initialMarble as T) : values[initialMarble];
|
values === undefined ? (initialMarble as T) : values[initialMarble];
|
||||||
// The remainder of the marble diagram should start on frame 1
|
// The remainder of the marble diagram should start on frame 1
|
||||||
return scope.behavior(
|
return scope.behavior(
|
||||||
helpers
|
helpers.hot(
|
||||||
.hot(`-${marbles.slice(initialMarbleIndex + 1)}`, values, error)
|
`-${marbles.slice(initialMarbleIndex + 1)}`,
|
||||||
.pipe(startWith(initialValue)),
|
values,
|
||||||
|
error,
|
||||||
|
),
|
||||||
|
initialValue,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user