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(