From e34f3dd219326ddc43e349bc2968def5792f9d2d 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. --- CHANGELOG.md | 1 + .../features/rooms/components/Conference.tsx | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7b2c313..c6b955b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to - 📝(docs) fix minor typos in comments and docstrings - ⬆️(backend) bump sqlparse from 0.5.5 to 0.6.0 - ⬆️(mail) bump @html-to/text-cli from 0.6.0 to 0.6.1 +- 🐛(frontend) treat client-initiated connect aborts as events ## [1.27.0] - 2026-08-14 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', })