From 71d9fbc36771108e32761f1ec0f35a4fcd1bae22 Mon Sep 17 00:00:00 2001 From: Yorun <547747006@qq.com> Date: Fri, 7 Apr 2023 14:51:08 +0800 Subject: [PATCH] fix: hide toast on cancel session deletion on mobile --- app/store/app.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/app/store/app.ts b/app/store/app.ts index e72163ebb..02fb4b32a 100644 --- a/app/store/app.ts +++ b/app/store/app.ts @@ -332,18 +332,19 @@ export const useChatStore = create()( const isLastSession = get().sessions.length === 1; if (!isMobileScreen() || confirm(Locale.Home.DeleteChat)) { get().removeSession(index); + + showToast(Locale.Home.DeleteToast, { + text: Locale.Home.Revert, + onClick() { + set((state) => ({ + sessions: state.sessions + .slice(0, index) + .concat([deletedSession]) + .concat(state.sessions.slice(index + Number(isLastSession))), + })); + }, + }); } - showToast(Locale.Home.DeleteToast, { - text: Locale.Home.Revert, - onClick() { - set((state) => ({ - sessions: state.sessions - .slice(0, index) - .concat([deletedSession]) - .concat(state.sessions.slice(index + Number(isLastSession))), - })); - }, - }); }, currentSession() {