From 9dfd12f4bb8e18d8416efe173a2d9395d8d34b5d Mon Sep 17 00:00:00 2001 From: jevb Date: Fri, 27 Mar 2026 14:41:36 +0100 Subject: [PATCH] fix: only save non-DM channels as "channel before DM" for back navigation --- Client/tauri-client/src/pages/main-page/SidebarArea.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Client/tauri-client/src/pages/main-page/SidebarArea.ts b/Client/tauri-client/src/pages/main-page/SidebarArea.ts index 08caa6a6..2e94706b 100644 --- a/Client/tauri-client/src/pages/main-page/SidebarArea.ts +++ b/Client/tauri-client/src/pages/main-page/SidebarArea.ts @@ -246,9 +246,13 @@ export function createSidebarArea(opts: SidebarAreaOptions): SidebarAreaResult { function selectDmConversation(dmChannel: DmChannel): void { // Save current channel so we can restore it when user clicks "Back" + // Only save if the current channel is a real text/voice channel, not another DM const currentActive = channelsStore.getState().activeChannelId; - if (currentActive !== null && currentActive !== dmChannel.channelId) { - channelBeforeDm = currentActive; + if (currentActive !== null) { + const currentCh = channelsStore.getState().channels.get(currentActive); + if (currentCh !== undefined && currentCh.type !== "dm") { + channelBeforeDm = currentActive; + } } setActiveDmUser(dmChannel.recipient.id);