Fix bug - when clicking on title in search results, was not switching to conversation
This commit is contained in:
@@ -8,7 +8,7 @@ import HoverButtons from './HoverButtons';
|
||||
import SiblingSwitch from './SiblingSwitch';
|
||||
import getIcon from '~/utils/getIcon';
|
||||
import { useMessageHandler } from '~/utils/handleSubmit';
|
||||
import { getConversationById } from '~/data-provider';
|
||||
import { useGetConversationByIdQuery } from '~/data-provider';
|
||||
import { cn } from '~/utils/';
|
||||
import store from '~/store';
|
||||
|
||||
@@ -32,6 +32,7 @@ export default function Message({
|
||||
const { ask, regenerate } = useMessageHandler();
|
||||
const { switchToConversation } = store.useConversation();
|
||||
const blinker = submitting && isSubmitting;
|
||||
const getConversationQuery = useGetConversationByIdQuery(message.conversationId, { enabled: false });
|
||||
|
||||
useEffect(() => {
|
||||
if (blinker && !abortScroll) {
|
||||
@@ -97,11 +98,9 @@ export default function Message({
|
||||
|
||||
const clickSearchResult = async () => {
|
||||
if (!searchResult) return;
|
||||
//we don't need react-query for this so we call the data service directly
|
||||
const convoResponse = await getConversationById(message.conversationId);
|
||||
const convo = convoResponse.data;
|
||||
|
||||
switchToConversation(convo);
|
||||
getConversationQuery.refetch(message.conversationId).then((response) => {
|
||||
switchToConversation(response.data);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user