From b2fa7a64d9eb65a9b99a6731b8a77f72734a20d4 Mon Sep 17 00:00:00 2001 From: lebaudantoine Date: Mon, 1 Jun 2026 15:22:01 +0200 Subject: [PATCH] wip for performance use a component instead of a hook to avoid render children --- .../Participants/MuteEveryoneButton.tsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/frontend/src/features/rooms/livekit/components/controls/Participants/MuteEveryoneButton.tsx b/src/frontend/src/features/rooms/livekit/components/controls/Participants/MuteEveryoneButton.tsx index 137ef866..1bb314ff 100644 --- a/src/frontend/src/features/rooms/livekit/components/controls/Participants/MuteEveryoneButton.tsx +++ b/src/frontend/src/features/rooms/livekit/components/controls/Participants/MuteEveryoneButton.tsx @@ -1,23 +1,20 @@ import { Button } from '@/primitives' import { useTranslation } from 'react-i18next' import type { Participant } from 'livekit-client' -import { useIsAdminOrOwner } from '@/features/rooms/livekit/hooks/useIsAdminOrOwner' import { useMuteParticipants } from '@/features/rooms/api/muteParticipants' import { RiMicOffLine } from '@remixicon/react' import { css } from '@/styled-system/css' +import { AdminOrOwnerOnly } from '@/features/rooms/components/AdminOrOwnerOnly' type MuteEveryoneButtonProps = { participants: Array } -export const MuteEveryoneButton = ({ - participants, -}: MuteEveryoneButtonProps) => { +const MuteEveryoneButtonInner = ({ participants }: MuteEveryoneButtonProps) => { const { muteParticipants } = useMuteParticipants() const { t } = useTranslation('rooms') - const isAdminOrOwner = useIsAdminOrOwner() - if (!isAdminOrOwner || !participants.length) return null + if (!participants.length) return null return (