Skip to content

Commit 687dc91

Browse files
🐛 fix: fix mobile switch when session selected (#167)
1 parent b226b9b commit 687dc91

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/store/session/slices/session/action.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,13 @@ export const createSessionSlice: StateCreator<
161161
Router.push(SESSION_CHAT_URL(id, get().isMobile));
162162
},
163163
switchSession: (sessionId = INBOX_SESSION_ID) => {
164-
if (get().activeId === sessionId) return;
164+
const { isMobile } = get();
165+
// mobile also should switch session due to chat mobile route is different
166+
// fix https://github.com/lobehub/lobe-chat/issues/163
167+
if (!isMobile && get().activeId === sessionId) return;
165168

166169
get().activeSession(sessionId);
167170

168-
Router.push(SESSION_CHAT_URL(sessionId, get().isMobile));
171+
Router.push(SESSION_CHAT_URL(sessionId, isMobile));
169172
},
170173
});

0 commit comments

Comments
 (0)