♻️(frontend) refactor backported LiveKit sources
Backported changes to LiveKit sources, eliminating the need to listen for specific Participant events.
This commit is contained in:
committed by
aleb_the_flash
parent
2a12715673
commit
998382020d
@@ -1,5 +1,4 @@
|
|||||||
import { css } from '@/styled-system/css'
|
import { css } from '@/styled-system/css'
|
||||||
import { allParticipantRoomEvents } from '@livekit/components-core'
|
|
||||||
import { useParticipants } from '@livekit/components-react'
|
import { useParticipants } from '@livekit/components-react'
|
||||||
|
|
||||||
import { Div, H } from '@/primitives'
|
import { Div, H } from '@/primitives'
|
||||||
@@ -8,7 +7,6 @@ import { ParticipantListItem } from '../../controls/Participants/ParticipantList
|
|||||||
import { ParticipantsCollapsableList } from '../../controls/Participants/ParticipantsCollapsableList'
|
import { ParticipantsCollapsableList } from '../../controls/Participants/ParticipantsCollapsableList'
|
||||||
import { HandRaisedListItem } from '../../controls/Participants/HandRaisedListItem'
|
import { HandRaisedListItem } from '../../controls/Participants/HandRaisedListItem'
|
||||||
import { LowerAllHandsButton } from '../../controls/Participants/LowerAllHandsButton'
|
import { LowerAllHandsButton } from '../../controls/Participants/LowerAllHandsButton'
|
||||||
import { RoomEvent } from 'livekit-client'
|
|
||||||
|
|
||||||
// TODO: Optimize rendering performance, especially for longer participant lists, even though they are generally short.
|
// TODO: Optimize rendering performance, especially for longer participant lists, even though they are generally short.
|
||||||
export const ParticipantsList = () => {
|
export const ParticipantsList = () => {
|
||||||
@@ -17,12 +15,7 @@ export const ParticipantsList = () => {
|
|||||||
// Preferred using the 'useParticipants' hook rather than the separate remote and local hooks,
|
// Preferred using the 'useParticipants' hook rather than the separate remote and local hooks,
|
||||||
// because the 'useLocalParticipant' hook does not update the participant's information when their
|
// because the 'useLocalParticipant' hook does not update the participant's information when their
|
||||||
// metadata/name changes. The LiveKit team has marked this as a TODO item in the code.
|
// metadata/name changes. The LiveKit team has marked this as a TODO item in the code.
|
||||||
const participants = useParticipants({
|
const participants = useParticipants()
|
||||||
updateOnlyOn: [
|
|
||||||
RoomEvent.ParticipantNameChanged,
|
|
||||||
...allParticipantRoomEvents,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const sortedRemoteParticipants = participants
|
const sortedRemoteParticipants = participants
|
||||||
.slice(1)
|
.slice(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user