mirror of
https://github.com/element-hq/element-call.git
synced 2026-10-22 10:22:30 +00:00
Explain why we use merge
This commit is contained in:
1 parent
53e038b09b
commit
4fd2f66949
1 file changed
+10
@@ -1164,6 +1164,16 @@ export function createCallViewModel$(
|
||||
* The media to be used to produce a layout.
|
||||
*/
|
||||
const layoutMedia$ = scope.behavior<LayoutMedia>(
|
||||
// We deliberately don't use combineLatest here. Several of the inputs
|
||||
// below derive from the same source. So one upstream change cascades
|
||||
// through them one at a time. combineLatest would see each step of the
|
||||
// cascade and emit layouts built from inputs that never coexisted.
|
||||
// Instead, we treat the emissions as a mere "something changed" signal
|
||||
// and read every input's current value. The derived behaviors were
|
||||
// subscribed before this one and a BehaviorSubject updates its value
|
||||
// before notifying. So by the time the first signal arrives every value
|
||||
// is already consistent. The duplicate signals from the rest of the
|
||||
// cascade are dropped by distinctUntilChanged.
|
||||
merge(
|
||||
windowMode$,
|
||||
layoutSwitchVm.layout$,
|
||||
|
||||
Reference in new issue
Block a user