From 4ad897e75613bad4b608375cc331085cfb86ffcf Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 3 Mar 2026 19:19:23 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(frontend)=20optimize=20enter?= =?UTF-8?q?Room=20calls=20in=20useWaitingParticipants?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace sequential await inside the loop with Promise.all, since each enterRoom call is independent. This prevents unnecessary delays when multiple participants are waiting (e.g. 10 participants previously resulted in ~10x longer execution time). --- .../rooms/hooks/useWaitingParticipants.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/frontend/src/features/rooms/hooks/useWaitingParticipants.ts b/src/frontend/src/features/rooms/hooks/useWaitingParticipants.ts index e583256b..d6821384 100644 --- a/src/frontend/src/features/rooms/hooks/useWaitingParticipants.ts +++ b/src/frontend/src/features/rooms/hooks/useWaitingParticipants.ts @@ -74,13 +74,17 @@ export const useWaitingParticipants = () => { ): Promise => { try { setListEnabled(false) - for (const participant of waitingParticipants) { - await enterRoom({ - roomId: roomId, - allowEntry, - participantId: participant.id, - }) - } + + await Promise.all( + waitingParticipants.map((participant) => + enterRoom({ + roomId: roomId, + allowEntry, + participantId: participant.id, + }) + ) + ) + await refetchWaiting() } catch (e) { console.error(e)