chore: add default channel

This commit is contained in:
steven
2023-03-28 11:45:52 +08:00
parent a41f42b32b
commit 7001170a27
2 changed files with 13 additions and 1 deletions

View File

@ -59,12 +59,18 @@ const ChatView = () => {
useEffect(() => {
if (!connectionStore.currentConnectionCtx) {
chatStore.setCurrentChat(undefined);
return;
}
if (currentChat?.connectionId === connectionStore.currentConnectionCtx.connection.id) {
chatStore.setCurrentChat(undefined);
return;
}
const chatList = chatStore.chatList.filter((chat) => chat.connectionId === connectionStore.currentConnectionCtx?.connection.id);
const chatList = chatStore.chatList.filter(
(chat) =>
chat.connectionId === connectionStore.currentConnectionCtx?.connection.id &&
chat.databaseName === connectionStore.currentConnectionCtx?.database?.name
);
chatStore.setCurrentChat(head(chatList));
}, [connectionStore.currentConnectionCtx]);