fix: the change assistant didn't take effect immediately #45 (#46)

* fix the change assistant didn't take effect immediately #45

* Update src/store/conversation.ts

Co-authored-by: boojack <stevenlgtm@gmail.com>

* change method name

* change method name

* fix the call method

---------

Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
CorrectRoadH
2023-04-20 21:08:00 +08:00
committed by GitHub
parent c28c18b77a
commit 473abb857c
6 changed files with 17 additions and 18 deletions

View File

@ -32,7 +32,7 @@ const ConversationView = () => {
const [isStickyAtBottom, setIsStickyAtBottom] = useState<boolean>(true);
const [showHeaderShadow, setShowHeaderShadow] = useState<boolean>(false);
const conversationViewRef = useRef<HTMLDivElement>(null);
const currentConversation = conversationStore.currentConversation;
const currentConversation = conversationStore.getConversationById(conversationStore.currentConversationId);
const messageList = messageStore.messageList.filter((message) => message.conversationId === currentConversation?.id);
const lastMessage = last(messageList);
@ -99,11 +99,10 @@ const ConversationView = () => {
conversation.connectionId === connectionStore.currentConnectionCtx?.connection.id &&
conversation.databaseName === connectionStore.currentConnectionCtx?.database?.name
);
conversationStore.setCurrentConversation(head(conversationList));
conversationStore.setCurrentConversationId(head(conversationList)?.id);
}, [currentConversation, connectionStore.currentConnectionCtx]);
const sendMessageToCurrentConversation = async () => {
const currentConversation = conversationStore.getState().currentConversation;
if (!currentConversation) {
return;
}