From 70cab79dd87a331acbd942832620961d4c4ef593 Mon Sep 17 00:00:00 2001 From: Claudemir Todo Bom Date: Sun, 15 Sep 2024 11:21:21 -0300 Subject: [PATCH] Internal chat: Fix duplicated new chat and blank screen when deleting --- frontend/src/pages/Chat/index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/Chat/index.js b/frontend/src/pages/Chat/index.js index 355b8dec..50f71538 100644 --- a/frontend/src/pages/Chat/index.js +++ b/frontend/src/pages/Chat/index.js @@ -70,6 +70,7 @@ export function ChatModal({ type, handleClose, handleLoadNewChat, + user, }) { const [users, setUsers] = useState([]); const [title, setTitle] = useState(""); @@ -77,7 +78,7 @@ export function ChatModal({ useEffect(() => { setTitle(""); setUsers([]); - if (type === "edit") { + if (type === "edit" && chat?.users) { const userList = chat.users.map((u) => ({ id: u.user.id, name: u.user.name, @@ -140,6 +141,7 @@ export function ChatModal({ setUsers(users)} initialUsers={users} + excludeId={user.id} /> @@ -460,6 +462,7 @@ function Chat(props) { history.push(`/chats/${data.uuid}`); }} handleClose={() => setShowDialog(false)} + user={user} /> {isWidthUp("md", props.width) ? renderGrid() : renderTab()}