From d53158b7c1087e506d2bfc0521d6f1b71f536f16 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Thu, 20 Aug 2026 23:21:17 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B(frontend)=20treat=20client-initiat?= =?UTF-8?q?ed=20connect=20aborts=20as=20events?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `connect()` calls can be aborted by a `disconnect()` before the join completes — typically when the user leaves, refreshes, navigates away early, or when the component remounts. This is expected behavior, not a failure. Stop reporting these as errors. Track them as analytics events instead, so we can still monitor their volume without polluting error dashboards. Volume is relatively low, but keeping visibility helps troubleshoot users who complain about difficulty connecting to a room, and could also flag a component that is re-rendering and killing the connection. --- .../features/rooms/components/Conference.tsx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/rooms/components/Conference.tsx b/src/frontend/src/features/rooms/components/Conference.tsx index 7149f999..bb9e2a11 100644 --- a/src/frontend/src/features/rooms/components/Conference.tsx +++ b/src/frontend/src/features/rooms/components/Conference.tsx @@ -6,6 +6,8 @@ import { usePersistentUserChoices, } from '@livekit/components-react' import { + ConnectionError, + ConnectionErrorReason, DisconnectReason, MediaDeviceFailure, Room, @@ -25,7 +27,11 @@ import { VideoConference } from '../livekit/prefabs/VideoConference' import { css } from '@/styled-system/css' import { BackgroundProcessorFactory } from '../livekit/components/blur' import { LocalUserChoices } from '@/stores/userChoices' -import { captureMediaEvent, reportError } from '@/features/analytics/telemetry' +import { + captureEvent, + captureMediaEvent, + reportError, +} from '@/features/analytics/telemetry' import { useConfig } from '@/api/useConfig' import { isFireFox } from '@/utils/livekit' import { useIsMobile } from '@/utils/useIsMobile' @@ -227,6 +233,16 @@ export const Conference = ({ onError={(e) => { const failure = MediaDeviceFailure.getFailure(e) if (failure && failure !== MediaDeviceFailure.Other) return + + // connect() was aborted by a disconnect() before the join completed + if ( + e instanceof ConnectionError && + e.reason === ConnectionErrorReason.Cancelled + ) { + void captureEvent('connection-cancelled') + return + } + reportError('livekit_room_error', e, { path: 'connect_publish', })