From 01f0c668b76cee5f2d6e74e7edca41d73a76fc58 Mon Sep 17 00:00:00 2001 From: Timo <16718859+toger5@users.noreply.github.com> Date: Thu, 1 Feb 2024 13:39:33 +0100 Subject: [PATCH] Hotfix fix: `waitForEvent` does resolve immediatly. (#12201) * New room header - add chat button during call - close lobby button in lobby - join button if session exists - allow to toggle call <-> timeline during call with call button Compound style for join button in call notify toast. Signed-off-by: Timo K * dont show start call, join button in video rooms. Signed-off-by: Timo K * Make active call check based on participant count Not based on available call object Signed-off-by: Timo K * fix room header tests Signed-off-by: Timo K * fix room header tests Signed-off-by: Timo K * remove chat button test for displaying. Chat button display logic is now part of the RoomHeader. Signed-off-by: Timo K * remove duplicate notification Tread icon Signed-off-by: Timo K * remove obsolete jest snapshot Signed-off-by: Timo K * Update src/components/views/rooms/RoomHeader.tsx Co-authored-by: Robin * update isECWidget logic Signed-off-by: Timo K * remove dead code Signed-off-by: Timo K * refactor call options Add menu to choose if there are multiple options Signed-off-by: Timo K * join ec when clicking join button (dont start jitsi) Use icon buttons don't show call icon when join button is visible Signed-off-by: Timo K * refactor isViewingCall Signed-off-by: Timo K * fix room header tests Signed-off-by: Timo K * fix header snapshot Signed-off-by: Timo K * sonar proposals Signed-off-by: Timo K * fix event shiftKey may be undefined Signed-off-by: Timo K * more lobby time before timeout only await sticky promise on becoming sticky. Signed-off-by: Timo K * don't allow starting new calls if there is an ongoing other call. Signed-off-by: Timo K * review Signed-off-by: Timo K * fix translation typo Signed-off-by: Timo K * missing await in case customTimeout=false Signed-off-by: Timo K --------- Signed-off-by: Timo K Co-authored-by: Robin --- src/models/Call.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/models/Call.ts b/src/models/Call.ts index 9daca1589c..aafbadb8c8 100644 --- a/src/models/Call.ts +++ b/src/models/Call.ts @@ -70,21 +70,18 @@ const waitForEvent = async ( let listener: (...args: any[]) => void; const wait = new Promise((resolve) => { listener = (...args) => { - if (pred(...args)) { - resolve(); - if (customTimeout === false) { - emitter.off(event, listener!); - } - } + if (pred(...args)) resolve(); }; emitter.on(event, listener); }); if (customTimeout !== false) { const timedOut = (await timeout(wait, false, customTimeout ?? TIMEOUT_MS)) === false; - emitter.off(event, listener!); if (timedOut) throw new Error("Timed out"); + } else { + await wait; } + emitter.off(event, listener!); }; export enum ConnectionState {