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);