️(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:
lebaudantoine
2026-07-13 20:11:17 +02:00
committed by aleb_the_flash
parent fb3a54a224
commit acb583b14f
@@ -76,7 +76,13 @@ export function Chat({ ...props }: ChatProps) {
})
// 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 previousMessageCount = React.useRef(0)