diff --git a/change-beta/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json b/change-beta/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json new file mode 100644 index 00000000000..ff1253fe000 --- /dev/null +++ b/change-beta/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json @@ -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": "79475487+mgamis-msft@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/change/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json b/change/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json new file mode 100644 index 00000000000..ff1253fe000 --- /dev/null +++ b/change/@azure-communication-react-cc8ce792-335e-4d9c-a07a-84eedc869f5e.json @@ -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": "79475487+mgamis-msft@users.noreply.github.com", + "dependentChangeType": "patch" +} diff --git a/packages/chat-component-bindings/src/baseSelectors.ts b/packages/chat-component-bindings/src/baseSelectors.ts index 31000a372c0..8038b18a95f 100644 --- a/packages/chat-component-bindings/src/baseSelectors.ts +++ b/packages/chat-component-bindings/src/baseSelectors.ts @@ -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; }; diff --git a/packages/chat-component-bindings/src/messageThreadSelector.ts b/packages/chat-component-bindings/src/messageThreadSelector.ts index 4268e005776..2c1750313b7 100644 --- a/packages/chat-component-bindings/src/messageThreadSelector.ts +++ b/packages/chat-component-bindings/src/messageThreadSelector.ts @@ -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;