Message / Reactions: Fix flickering avatars in posts (#224)

This commit is contained in:
Ibrahima G. Coulibaly 2023-01-22 19:17:29 +01:00 committed by GitHub
parent 24957c958e
commit cd4047084f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -692,6 +692,7 @@ const Message: FC<OwnProps & StateProps> = ({
availableReactions={availableReactions}
genericEffects={genericEffects}
observeIntersection={observeIntersectionForPlaying}
noRecentReactors={isChannel}
/>
);
}
@ -1149,6 +1150,7 @@ const Message: FC<OwnProps & StateProps> = ({
availableReactions={availableReactions}
genericEffects={genericEffects}
observeIntersection={observeIntersectionForPlaying}
noRecentReactors={isChannel}
/>
)}
</div>

View File

@ -20,6 +20,7 @@ type OwnProps = {
metaChildren?: React.ReactNode;
genericEffects?: ApiStickerSet;
observeIntersection?: ObserveFn;
noRecentReactors?: boolean;
};
const MAX_RECENT_AVATARS = 3;
@ -32,6 +33,7 @@ const Reactions: FC<OwnProps> = ({
metaChildren,
genericEffects,
observeIntersection,
noRecentReactors,
}) => {
const totalCount = useMemo(() => (
message.reactions!.results.reduce((acc, reaction) => acc + reaction.count, 0)
@ -46,7 +48,7 @@ const Reactions: FC<OwnProps> = ({
message={message}
activeReactions={activeReactions}
availableReactions={availableReactions}
withRecentReactors={totalCount <= MAX_RECENT_AVATARS}
withRecentReactors={totalCount <= MAX_RECENT_AVATARS && !noRecentReactors}
genericEffects={genericEffects}
observeIntersection={observeIntersection}
/>