From ca9c7fc15266c38926c2ed16245acdeff738642a Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Tue, 3 Mar 2026 19:34:20 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F(frontend)=20avoid=20non-prim?= =?UTF-8?q?itive=20default=20props=20recreation=20on=20each=20render?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The empty object literal created a new reference every render, potentially triggering unnecessary re-renders. Hoist an EMPTY_PROPS constant to the module level and reuse it instead of allocating a new object. --- .../src/features/settings/components/tabs/VideoTab.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/settings/components/tabs/VideoTab.tsx b/src/frontend/src/features/settings/components/tabs/VideoTab.tsx index 4bbcf62d..90607654 100644 --- a/src/frontend/src/features/settings/components/tabs/VideoTab.tsx +++ b/src/frontend/src/features/settings/components/tabs/VideoTab.tsx @@ -22,6 +22,8 @@ export type VideoTabProps = Pick & type DeviceItems = Array<{ value: string; label: string }> +const EMPTY_PROPS = {} + export const VideoTab = ({ id }: VideoTabProps) => { const { t } = useTranslation('settings', { keyPrefix: 'video' }) const { localParticipant, remoteParticipants } = useRoomContext() @@ -59,7 +61,7 @@ export const VideoTab = ({ id }: VideoTabProps) => { const isCamEnabled = devicesIn?.length > 0 const disabledProps = isCamEnabled - ? {} + ? EMPTY_PROPS : { placeholder: t('permissionsRequired'), isDisabled: true,