diff --git a/src/components/Post/Embed/VideoEmbed/index.web.tsx b/src/components/Post/Embed/VideoEmbed/index.web.tsx index 0b4640e968..8d5a816021 100644 --- a/src/components/Post/Embed/VideoEmbed/index.web.tsx +++ b/src/components/Post/Embed/VideoEmbed/index.web.tsx @@ -263,7 +263,15 @@ function VideoError({ const errorMessage = error instanceof Error ? error.message : String(error) const presentation = embed.presentation === 'gif' ? 'gif' : 'video' const playlist = embed.playlist + /* + * Fire exactly once per failure - the analytics context identity can change + * (session/geolocation updates) while this fallback stays mounted, which + * would otherwise re-run the effect and double-count. + */ + const fired = useRef(false) useEffect(() => { + if (fired.current) return + fired.current = true ax.metric('video:playback:failed', { surface: 'feed', presentation,