From 7844dfcc12e7f95d424daf10ef32b3e21efed2a7 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Sat, 5 Sep 2026 00:25:22 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=88(frontend)=20track=20missing=20lobb?= =?UTF-8?q?y=20participant=20on=20accept/reject?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a moderator accepts or rejects a lobby entry that no longer exists, emit a tracking event so we can measure how often it happens. This signal will help tune the lobby polling interval: too many "not found" events means the moderator side is working from a stale list. Keep raising the error to the client on top of tracking it, so the frontend still surfaces the issue (its current handling of this case is still incomplete). --- CHANGELOG.md | 1 + .../features/participants/api/enterRoom.ts | 25 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d978995..319b8b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to - ✨(backend) add Traefik support via configurable media-auth url header #1649 - ✨(backend) update a room's attributes from the external API - 🔊(backend) log request duration in Gunicorn workers +- 📈(frontend) track missing lobby participant on accept/reject ### Changed diff --git a/src/frontend/src/features/participants/api/enterRoom.ts b/src/frontend/src/features/participants/api/enterRoom.ts index 2c8c618a..80d70d3a 100644 --- a/src/frontend/src/features/participants/api/enterRoom.ts +++ b/src/frontend/src/features/participants/api/enterRoom.ts @@ -1,5 +1,6 @@ import { ApiError } from '@/api/ApiError' import { fetchApi } from '@/api/fetchApi' +import { captureEvent } from '@/features/analytics/telemetry' import { useMutation, type UseMutationOptions } from '@tanstack/react-query' export interface EnterRoomParams { @@ -17,13 +18,23 @@ export const enterRoom = async ({ allowEntry, participantId, }: EnterRoomParams): Promise => { - return await fetchApi(`/rooms/${roomId}/enter/`, { - method: 'POST', - body: JSON.stringify({ - participant_id: participantId, - allow_entry: allowEntry, - }), - }) + try { + return await fetchApi(`/rooms/${roomId}/enter/`, { + method: 'POST', + body: JSON.stringify({ + participant_id: participantId, + allow_entry: allowEntry, + }), + }) + } catch (error) { + if (error instanceof ApiError && error.statusCode === 404) { + captureEvent('lobby_entry_participant_gone', { + room_id: roomId, + allow_entry: allowEntry, + }) + } + throw error + } } export function useEnterRoom(