@@ -245,7 +245,8 @@ export const VideoTile = (props: VideoTileProps): JSX.Element => {
245245 const [ isHovered , setIsHovered ] = useState < boolean > ( false ) ;
246246 /* @conditional -compile-remove(pinned-participants) */
247247 const [ isFocused , setIsFocused ] = useState < boolean > ( false ) ;
248- const [ personaSize , setPersonaSize ] = useState < number > ( ) ;
248+ // need to set a default otherwise the resizeObserver will get stuck in an infinite loop.
249+ const [ personaSize , setPersonaSize ] = useState < number > ( 1 ) ;
249250 const videoTileRef = useRef < HTMLDivElement > ( null ) ;
250251
251252 const locale = useLocale ( ) ;
@@ -256,8 +257,11 @@ export const VideoTile = (props: VideoTileProps): JSX.Element => {
256257 const observer = useRef (
257258 new ResizeObserver ( ( entries ) : void => {
258259 const { width, height } = entries [ 0 ] . contentRect ;
259- const personaSize = Math . min ( width , height ) / 3 ;
260- setPersonaSize ( Math . max ( Math . min ( personaSize , personaMaxSize ) , personaMinSize ) ) ;
260+ const personaCalcSize = Math . min ( width , height ) / 3 ;
261+ // we only want to set the persona size if it has changed
262+ if ( personaCalcSize !== personaSize ) {
263+ setPersonaSize ( Math . max ( Math . min ( personaCalcSize , personaMaxSize ) , personaMinSize ) ) ;
264+ }
261265 } )
262266 ) ;
263267
0 commit comments