Skip to content

Commit 6c453d7

Browse files
authored
Doesn't error if owner not found (#614)
1 parent 58b9325 commit 6c453d7

2 files changed

Lines changed: 5 additions & 6 deletions

File tree

workbench-app/src/components/FrontDoor/Controls/ConversationItem.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,10 @@ export const ConversationItem: React.FC<ConversationItemProps> = (props) => {
324324

325325
const sortedParticipantsByOwnerMeOthers = React.useMemo(() => {
326326
const participants: ConversationParticipant[] = [];
327-
participants.push(getOwnerParticipant(conversation));
327+
const owner = getOwnerParticipant(conversation);
328+
if (owner) {
329+
participants.push(owner);
330+
}
328331
if (wasSharedWithMe(conversation)) {
329332
const me = conversation.participants.find((participant) => participant.id === localUserId);
330333
if (me) {

workbench-app/src/libs/useConversationUtility.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,7 @@ export const useConversationUtility = () => {
5353
//
5454

5555
const getOwnerParticipant = React.useCallback((conversation: Conversation) => {
56-
const owner = conversation.participants.find((participant) => participant.id === conversation.ownerId);
57-
if (!owner) {
58-
throw new Error('Owner not found in conversation participants');
59-
}
60-
return owner;
56+
return conversation.participants.find((participant) => participant.id === conversation.ownerId);
6157
}, []);
6258

6359
const wasSharedWithMe = React.useCallback(

0 commit comments

Comments
 (0)