From 847139e7ce51f906e674d2b5a0340616b2bc6d54 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 30 Jan 2023 15:55:32 +0100 Subject: [PATCH] Avatar: Fix unexpected video avatars (#2413) --- src/components/common/Avatar.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/common/Avatar.tsx b/src/components/common/Avatar.tsx index 23787ec8b..33380b0ab 100644 --- a/src/components/common/Avatar.tsx +++ b/src/components/common/Avatar.tsx @@ -124,7 +124,8 @@ const Avatar: FC = ({ const imgBlobUrl = useMedia(imageHash, false, ApiMediaFormat.BlobUrl, lastSyncTime); const videoBlobUrl = useMedia(videoHash, !shouldLoadVideo, ApiMediaFormat.BlobUrl, lastSyncTime); const hasBlobUrl = Boolean(imgBlobUrl || videoBlobUrl); - const shouldPlayVideo = Boolean(isIntersecting && videoBlobUrl); + // `videoBlobUrl` can be taken from memory cache, so we need to check `shouldLoadVideo` again + const shouldPlayVideo = Boolean(isIntersecting && videoBlobUrl && shouldLoadVideo); const { transitionClassNames } = useShowTransition(hasBlobUrl, undefined, hasBlobUrl, 'slow');