From 1d7b7bd0b6e64b984c3a037024841de70bf581d4 Mon Sep 17 00:00:00 2001 From: Gianni Ferullo Date: Thu, 30 Jan 2025 10:12:39 -0500 Subject: [PATCH] don't clear an existing src --- packages/react-components/src/components/gif.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-components/src/components/gif.tsx b/packages/react-components/src/components/gif.tsx index ea5f205f..4935e372 100644 --- a/packages/react-components/src/components/gif.tsx +++ b/packages/react-components/src/components/gif.tsx @@ -230,8 +230,10 @@ const Gif = ({ useEffect(() => { showGifObserver.current = new IntersectionObserver(([entry]: IntersectionObserverEntry[]) => { const { isIntersecting } = entry - // show the gif if the container is on the screen - setShouldShowMedia(isIntersecting) + // show the gif if the container is on the screen, and we haven't show it yet + if (image.current?.src === placeholder) { + setShouldShowMedia(isIntersecting) + } // remove the fullGifObserver if we go off the screen // we may have already disconnected if the hasFiredSeen happened if (!isIntersecting && fullGifObserver.current) {