fix(appList): 删除应用后回到聊天选择最后一次对话的应用时提示无该应用bug (#2236)

This commit is contained in:
lolocoo
2024-08-02 10:14:39 +08:00
committed by GitHub
parent 3760726354
commit af1cff6230

View File

@@ -39,6 +39,7 @@ import { getTeamMembers } from '@/web/support/user/team/api';
import { formatTimeToChatTime } from '@fastgpt/global/common/string/time';
import { useSystem } from '@fastgpt/web/hooks/useSystem';
import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useChatStore } from '@/web/core/chat/context/storeChat';
const HttpEditModal = dynamic(() => import('./HttpPluginEditModal'));
const ListItem = () => {
@@ -47,6 +48,8 @@ const ListItem = () => {
const router = useRouter();
const { parentId = null } = router.query;
const { isPc } = useSystem();
const { lastChatAppId, setLastChatAppId } = useChatStore();
const { myApps, loadMyApps, onUpdateApp, setMoveAppId, folderDetail } = useContextSelector(
AppListContext,
@@ -83,6 +86,9 @@ const ListItem = () => {
});
const { runAsync: onclickDelApp } = useRequest2(
(id: string) => {
if (id === lastChatAppId) {
setLastChatAppId('');
}
return delAppById(id);
},
{