Skip to content

Commit

Permalink
Read receipts selector fix (#5063)
Browse files Browse the repository at this point in the history
* Fix chat selectors using read receipts from state

* Change files
  • Loading branch information
mgamis-msft authored Aug 23, 2024
1 parent 93d0e04 commit 41bed59
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Read receipt selector",
"comment": "Fix chat selectors using read receipts from state",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Read receipt selector",
"comment": "Fix chat selectors using read receipts from state",
"packageName": "@azure/communication-react",
"email": "[email protected]",
"dependentChangeType": "patch"
}
5 changes: 4 additions & 1 deletion packages/chat-component-bindings/src/baseSelectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ export const getParticipants = (
/**
* @private
*/
export const getReadReceipts = (state: ChatClientState, props: ChatBaseSelectorProps): ChatMessageReadReceipt[] => {
export const getReadReceipts = (
state: ChatClientState,
props: ChatBaseSelectorProps
): ChatMessageReadReceipt[] | undefined => {
return state.threads[props?.threadId]?.readReceipts;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ const hasValidParticipant = (chatMessage: ChatMessageWithStatus): boolean =>
export const messageThreadSelectorWithThread: () => MessageThreadSelector = () =>
createSelector(
[getUserId, getChatMessages, getLatestReadTime, getIsLargeGroup, getReadReceipts, getParticipants],
(userId, chatMessages, latestReadTime, isLargeGroup, readReceipts, participants) => {
(userId, chatMessages, latestReadTime, isLargeGroup, readReceipts = [], participants) => {
// We can't get displayName in teams meeting interop for now, disable rr feature when it is teams interop
const isTeamsInterop = Object.values(participants).find((p) => 'microsoftTeamsUserId' in p.id) !== undefined;

Expand Down

0 comments on commit 41bed59

Please sign in to comment.