fix: only save non-DM channels as "channel before DM" for back navigation

This commit is contained in:
jevb
2026-03-27 14:41:36 +01:00
parent ac74252304
commit 9dfd12f4bb
@@ -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);