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() {