From 249873db96760b395cd7066a3041cd7293ed1868 Mon Sep 17 00:00:00 2001 From: Arjun Patel Date: Mon, 17 Jan 2022 14:51:58 -0800 Subject: [PATCH] bug fixing --- components/RoomCard.tsx | 8 ++++++++ models/room.ts | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/components/RoomCard.tsx b/components/RoomCard.tsx index 5cf76c5..f7d8ea8 100644 --- a/components/RoomCard.tsx +++ b/components/RoomCard.tsx @@ -28,6 +28,10 @@ export default function RoomCard(props: IRoomCardProps) { // show members who are in the invite list but not already in the room const membersInvited = () => { + if (!listOfValidUserIdsInRoom) { + return; + } + const invitedMembersNotInRoom = props.room.members?.filter( (memberId) => !listOfValidUserIdsInRoom.includes(memberId) ); @@ -81,6 +85,10 @@ export default function RoomCard(props: IRoomCardProps) { }; const membersInRoom = () => { + if (!listOfValidUserIdsInRoom) { + return; + } + const listOfUsersInRoom: User[] = listOfValidUserIdsInRoom.map( (userId) => teamUsersMap[userId] ); diff --git a/models/room.ts b/models/room.ts index 8936c52..130046d 100644 --- a/models/room.ts +++ b/models/room.ts @@ -8,9 +8,9 @@ export default class Room { link: string; // google meet link for now - members: string[]; //userIds of "mandatory"/invited people including the person who created it + members: string[] = []; //userIds of "mandatory"/invited people including the person who created it - membersInRoom: string[]; + membersInRoom: string[] = []; attachments: string[]; // the links themselves (NOT Ids)...there will be duplicate entries in the attachments table which will be created