From b554fa63d17e38cc4f8ee8c8f97012a5d71d916b Mon Sep 17 00:00:00 2001 From: Robin Date: Mon, 17 Aug 2026 16:45:26 +0200 Subject: [PATCH] Performance: Isolate tile store debug info in its own component It's very uncommon to have this debug option enabled, and yet it currently causes the footer to re-render on every layout update, which is a small but avoidable cost. --- src/components/CallFooter.tsx | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/CallFooter.tsx b/src/components/CallFooter.tsx index f5c54ee38..b3e0e4f30 100644 --- a/src/components/CallFooter.tsx +++ b/src/components/CallFooter.tsx @@ -26,6 +26,7 @@ import { MediaMuteAndSwitchButton, type MenuOptions, } from "./MediaMuteAndSwitchButton"; +import { type Behavior } from "../state/Behavior"; import { type ViewModel } from "../state/ViewModel"; import { useBehavior } from "../useBehavior"; import { type LayoutSwitchViewModel } from "../state/LayoutSwitchViewModel"; @@ -135,7 +136,6 @@ export const CallFooter: FC = ({ const audioOutputSwitcher = useBehavior(vm.audioOutputSwitcher$); const hangup = useBehavior(vm.hangup$); const debugTileLayout = useBehavior(vm.debugTileLayout$); - const tileStoreGeneration = useBehavior(vm.tileStoreGeneration$); const videoOptions = useBehavior(vm.videoOptions$); const selectedVideo = useBehavior(vm.selectedVideo$); const audioOptions = useBehavior(vm.audioOptions$); @@ -283,7 +283,9 @@ export const CallFooter: FC = ({ /> )} - {debugTileLayout ? `Tiles generation: ${tileStoreGeneration}` : undefined} + {debugTileLayout ? ( + + ) : undefined} ); @@ -316,3 +318,14 @@ export const CallFooter: FC = ({ ); }; + +interface TilesDebugInfoProps { + generation$: Behavior; +} + +// Isolated in its own component since the layout generation updates frequently +// and we can avoid re-rendering the footer this way +const TilesDebugInfo: FC = ({ generation$ }) => { + const generation = useBehavior(generation$); + return `Tiles generation: ${generation}`; +};