️(frontend) read pinned track imperatively in ParticipantTile

In the participant tile, there is no need to read the pinned track
through a Valtio snapshot, which would trigger a re-render every
time the pinned track changes, for every participant tile.

Switch to an imperative read of the store to avoid these unnecessary
re-renders.
This commit is contained in:
lebaudantoine
2026-07-15 12:31:20 +02:00
committed by aleb_the_flash
parent 56a8f72e39
commit 94abdfc0f9
@@ -37,7 +37,6 @@ import { useTranslation } from 'react-i18next'
import { getShortcutDescriptorById } from '@/features/shortcuts/catalog'
import { formatShortcutLabel } from '@/features/shortcuts/formatLabels'
import { KeyboardShortcutHint } from './KeyboardShortcutHint'
import { useSnapshot } from 'valtio'
import { layoutStore, clearPinnedTrack } from '@/stores/layout'
export function TrackRefContextIfNeeded(
@@ -77,7 +76,6 @@ export const ParticipantTile: (
}: ParticipantTileExtendedProps,
ref
) {
const { pinnedTrackRef } = useSnapshot(layoutStore)
const trackReference = useEnsureTrackRef(trackRef)
const { identity, name } = useParticipantInfo({
@@ -98,13 +96,13 @@ export const ParticipantTile: (
if (
trackReference.source &&
!subscribed &&
pinnedTrackRef &&
isEqualTrackRef(trackReference, pinnedTrackRef)
layoutStore.pinnedTrackRef &&
isEqualTrackRef(trackReference, layoutStore.pinnedTrackRef)
) {
clearPinnedTrack()
}
},
[trackReference, pinnedTrackRef]
[trackReference]
)
const { isHandRaised } = useRaisedHand({