Media Viewer: Fix flickering profile picture (#1987)

This commit is contained in:
Alexander Zinchuk 2022-08-07 21:16:05 +02:00
parent 54b5c8c7e4
commit 206e9d063d

View File

@ -63,15 +63,18 @@ export const useMediaProps = ({
if (avatarMedia) {
if (avatarMedia.isVideo && isFull) {
return getVideoAvatarMediaHash(avatarMedia);
} else if (mediaId === 0) {
// Show preloaded avatar if this is the first media (when user clicks on profile info avatar)
return getChatAvatarHash(avatarOwner, isFull ? 'big' : 'normal');
} else {
return `photo${avatarMedia.id}?size=c`;
}
} else {
return getChatAvatarHash(avatarOwner!, isFull ? 'big' : 'normal');
return getChatAvatarHash(avatarOwner, isFull ? 'big' : 'normal');
}
}
return message && getMessageMediaHash(message, isFull ? 'viewerFull' : 'viewerPreview');
}, [avatarOwner, avatarMedia, message]);
}, [avatarOwner, message, avatarMedia, mediaId]);
const pictogramBlobUrl = useMedia(
message && (isFromSharedMedia || isFromSearch) && getMessageMediaHash(message, 'pictogram'),