Skip to content

Commit f093028

Browse files
committed
fix: use process reactions improvements for thread list
1 parent 0759817 commit f093028

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

package/src/components/Message/hooks/useProcessReactions.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ const isOwnReaction = <
5454
>(
5555
reactionType: string,
5656
ownReactions?: MessageReactionsData<StreamChatGenerics>['own_reactions'],
57-
) => (ownReactions ? ownReactions.some((reaction) => reaction.type === reactionType) : false);
57+
latestReactions?: ReactionResponse<StreamChatGenerics>[] | null,
58+
userID?: string,
59+
) =>
60+
(ownReactions ? ownReactions.some((reaction) => reaction.type === reactionType) : false) ||
61+
(latestReactions
62+
? latestReactions.some(
63+
(reaction) => reaction?.user?.id === userID && reaction.type === reactionType,
64+
)
65+
: false);
5866

5967
const isSupportedReaction = (reactionType: string, supportedReactions?: ReactionData[]) =>
6068
supportedReactions
@@ -109,7 +117,12 @@ export const useProcessReactions = <
109117
Icon: getEmojiByReactionType(reactionType, supportedReactions),
110118
lastReactionAt: last_reaction_at ? new Date(last_reaction_at) : null,
111119
latestReactedUserNames,
112-
own: isOwnReaction<StreamChatGenerics>(reactionType, own_reactions),
120+
own: isOwnReaction<StreamChatGenerics>(
121+
reactionType,
122+
own_reactions,
123+
latest_reactions,
124+
client.userID,
125+
),
113126
type: reactionType,
114127
unlistedReactedUserCount: count - latestReactedUserNames.length,
115128
};

0 commit comments

Comments
 (0)