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

View File

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