From c9f2a1c94370cb23500e307759a51a4cd9312105 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Fri, 7 Mar 2025 11:18:28 +0100 Subject: [PATCH] Reduce redundant calculations of display name map (#3062) * Use share() on fromEvent() so that we multiplex subscribers onto the event emitter * . * . * Comment * Comment --------- Co-authored-by: Hugh Nimmo-Smith --- src/state/CallViewModel.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/state/CallViewModel.ts b/src/state/CallViewModel.ts index f634233e..ce104396 100644 --- a/src/state/CallViewModel.ts +++ b/src/state/CallViewModel.ts @@ -496,6 +496,10 @@ export class CallViewModel extends ViewModel { } return displaynameMap; }), + // It turns out that doing the disambiguation above is rather expensive on Safari (10x slower + // than on Chrome/Firefox). This means it is important that we share() the result so that we + // don't do this work more times than we need to. This is achieve through the state() operator: + this.scope.state(), ); /**