mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-30 12:09:08 +00:00
⚡️(frontend) narrow chat participant list update events
Reduce the set of events that trigger an update of the participant list in the chat, keeping only those relevant to display: attribute and name changes. This avoids unnecessary re-renders when other, unrelated participant events fire.
This commit is contained in:
@@ -76,7 +76,13 @@ export function Chat({ ...props }: ChatProps) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Use useParticipants hook to trigger a re-render when the participant list changes.
|
// Use useParticipants hook to trigger a re-render when the participant list changes.
|
||||||
const participants = useParticipants()
|
const participants = useParticipants({
|
||||||
|
updateOnlyOn: [
|
||||||
|
RoomEvent.ParticipantAttributesChanged,
|
||||||
|
RoomEvent.ParticipantNameChanged,
|
||||||
|
RoomEvent.ParticipantMetadataChanged,
|
||||||
|
],
|
||||||
|
})
|
||||||
|
|
||||||
const lastReadMsgAt = React.useRef<ChatMessage['timestamp']>(0)
|
const lastReadMsgAt = React.useRef<ChatMessage['timestamp']>(0)
|
||||||
const previousMessageCount = React.useRef(0)
|
const previousMessageCount = React.useRef(0)
|
||||||
|
|||||||
Reference in New Issue
Block a user