Skip to content

Commit

Permalink
🐛 fix: fix a bug when click inbox not switch back to chat page
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Oct 31, 2023
1 parent 4028109 commit 31f6d29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
9 changes: 2 additions & 7 deletions src/app/chat/features/SessionListContent/Inbox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,15 @@ import ListItem from '../ListItem';
const Inbox = memo(() => {
const { t } = useTranslation('chat');
const { mobile } = useResponsive();
const [activeId, activeSession, switchSession] = useSessionStore((s) => [
s.activeId,
s.activeSession,
s.switchSession,
]);
const [activeId, switchSession] = useSessionStore((s) => [s.activeId, s.switchSession]);

return (
<Link
aria-label={t('inbox.title')}
href={SESSION_CHAT_URL(INBOX_SESSION_ID, mobile)}
onClick={(e) => {
e.preventDefault();
if (mobile) switchSession(INBOX_SESSION_ID);
else activeSession(INBOX_SESSION_ID);
switchSession(INBOX_SESSION_ID);
}}
>
<ListItem
Expand Down
3 changes: 0 additions & 3 deletions src/store/session/slices/session/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,6 @@ export const createSessionSlice: StateCreator<
},
switchSession: (sessionId = INBOX_SESSION_ID) => {
const { isMobile, router } = 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);

Expand Down

0 comments on commit 31f6d29

Please sign in to comment.