Skip to content

Commit

Permalink
Internal chat: Fix duplicated new chat and blank screen when deleting
Browse files Browse the repository at this point in the history
  • Loading branch information
allgood committed Sep 15, 2024
1 parent ed0cb2c commit 70cab79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion frontend/src/pages/Chat/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,15 @@ export function ChatModal({
type,
handleClose,
handleLoadNewChat,
user,
}) {
const [users, setUsers] = useState([]);
const [title, setTitle] = useState("");

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,
Expand Down Expand Up @@ -140,6 +141,7 @@ export function ChatModal({
<UsersFilter
onFiltered={(users) => setUsers(users)}
initialUsers={users}
excludeId={user.id}
/>
</Grid>
</Grid>
Expand Down Expand Up @@ -460,6 +462,7 @@ function Chat(props) {
history.push(`/chats/${data.uuid}`);
}}
handleClose={() => setShowDialog(false)}
user={user}
/>
<Paper className={classes.mainContainer}>
{isWidthUp("md", props.width) ? renderGrid() : renderTab()}
Expand Down

0 comments on commit 70cab79

Please sign in to comment.