From 12d7fb365c31015e3612350784f39e64db7b597e Mon Sep 17 00:00:00 2001 From: Jannis Braun <151788261+TheZwiss@users.noreply.github.com> Date: Fri, 27 Mar 2026 03:52:57 +0100 Subject: [PATCH] feat: add leave confirmation dialog for group DM close button The X button on group DMs now opens a ConfirmDialog instead of soft-closing. The right-click 'Leave Group' context menu also routes through the same confirmation. Prevents dead group DM data from accumulating when users soft-close instead of leaving. --- .../src/components/layout/ChannelSidebar.tsx | 75 ++++++++++++++++--- 1 file changed, 63 insertions(+), 12 deletions(-) diff --git a/packages/web/src/components/layout/ChannelSidebar.tsx b/packages/web/src/components/layout/ChannelSidebar.tsx index 7a453b8b..de146dc6 100644 --- a/packages/web/src/components/layout/ChannelSidebar.tsx +++ b/packages/web/src/components/layout/ChannelSidebar.tsx @@ -109,6 +109,8 @@ export function ChannelSidebar() { // Delete category confirmation state const [deleteCategoryId, setDeleteCategoryId] = useState(null); const [deleteCategoryLoading, setDeleteCategoryLoading] = useState(false); + const [leaveGroupDmId, setLeaveGroupDmId] = useState(null); + const [leaveGroupDmLoading, setLeaveGroupDmLoading] = useState(false); // Centralized context menu const openContextMenu = useContextMenuStore((s) => s.open); @@ -378,15 +380,11 @@ export function ChannelSidebar() { ), onClick: () => { - if (currentChannelId === dmId) { - navigate('/channels/@me'); - setCurrentChannel(null); - } - useSpaceStore.getState().leaveDm(dmId); + setLeaveGroupDmId(dmId); }, }, ]); - }, [openContextMenu, currentChannelId, navigate, setCurrentChannel]); + }, [openContextMenu]); const handleChannelClick = (channelId: string) => { setCurrentChannel(channelId); @@ -568,15 +566,18 @@ export function ChannelSidebar() {