Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

Fix bug - when clicking on title in search results, was not switching to conversation

Daniel D Orlandoc983670b9ed9
diff --git a/client/src/components/Messages/Message.jsx b/client/src/components/Messages/Message.jsx
index 3c6c30129c..eec7f96bd0 100644
--- a/client/src/components/Messages/Message.jsx
+++ b/client/src/components/Messages/Message.jsx
@@ -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 (