Skip to content

Commit

Permalink
🐛 fix: fix mobile switch when session selected (lobehub#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx authored Sep 9, 2023
1 parent fa86e42 commit 40d8a11
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/store/session/slices/session/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,13 @@ export const createSessionSlice: StateCreator<
Router.push(SESSION_CHAT_URL(id, get().isMobile));
},
switchSession: (sessionId = INBOX_SESSION_ID) => {
if (get().activeId === sessionId) return;
const { isMobile } = get();
// mobile also should switch session due to chat mobile route is different
// fix https://github.com/lobehub/lobe-chat/issues/163
if (!isMobile && get().activeId === sessionId) return;

get().activeSession(sessionId);

Router.push(SESSION_CHAT_URL(sessionId, get().isMobile));
Router.push(SESSION_CHAT_URL(sessionId, isMobile));
},
});

0 comments on commit 40d8a11

Please sign in to comment.