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
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
fix(Chat): correctly render when refreshing/visiting a conversation page (#1037)
Danny Avila495ac1b36d2a
diff --git a/client/src/components/Nav/NewChat.tsx b/client/src/components/Nav/NewChat.tsxindex fa2a8aa184..a876f4a810 100644--- a/client/src/components/Nav/NewChat.tsx+++ b/client/src/components/Nav/NewChat.tsx@@ -1,14 +1,14 @@-import React from 'react';+import { useNavigate } from 'react-router-dom';import { useLocalize, useConversation } from '~/hooks';export default function NewChat() {const { newConversation } = useConversation();+ const navigate = useNavigate();const localize = useLocalize();const clickHandler = () => {- // dispatch(setInputValue(''));- // dispatch(setQuery(''));newConversation();+ navigate('/chat/new');};return (diff --git a/client/src/routes/Chat.tsx b/client/src/routes/Chat.tsxindex eb39c987d9..d24ef3e085 100644--- a/client/src/routes/Chat.tsx+++ b/client/src/routes/Chat.tsx@@ -27,7 +27,7 @@ export default function Chat() {const navigate = useNavigate();//disabled by default, we only enable it when messagesTree is null- const messagesQuery = useGetMessagesByConvoId(conversationId ?? '', { enabled: false });+ const messagesQuery = useGetMessagesByConvoId(conversationId ?? '', { enabled: !messagesTree });const getConversationMutation = useGetConversationByIdMutation(conversationId ?? '');const { data: config } = useGetStartupConfig();@@ -89,7 +89,8 @@ export default function Chat() {setShouldNavigate(false);}// conversationId (in url) should always follow conversation?.conversationId, unless conversation is null- else if (conversation?.conversationId !== conversationId) {+ // messagesTree is null when user navigates, but not on page refresh, so we need to navigate in this case+ else if (conversation?.conversationId !== conversationId && !messagesTree) {if (shouldNavigate) {navigate(`/chat/${conversation?.conversationId}`);} else {