From efe057e0d8682c0c21638d6d4abf47f06d16fa8d Mon Sep 17 00:00:00 2001 From: Danny Avila <110412045+danny-avila@users.noreply.github.com> Date: Thu, 9 Nov 2023 14:32:03 -0500 Subject: [PATCH] fix: correctly pass modelsData to newConversation, also prevent navigation in this case (#1162) --- client/src/hooks/useConversation.ts | 2 +- client/src/routes/Root.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/client/src/hooks/useConversation.ts b/client/src/hooks/useConversation.ts index 2ebde99326..1f4ca6cf29 100644 --- a/client/src/hooks/useConversation.ts +++ b/client/src/hooks/useConversation.ts @@ -51,7 +51,7 @@ const useConversation = () => { setSubmission({} as TSubmission); resetLatestMessage(); - if (conversation.conversationId === 'new') { + if (conversation.conversationId === 'new' && !modelsData) { navigate('/chat/new'); } }, diff --git a/client/src/routes/Root.tsx b/client/src/routes/Root.tsx index cfd3e5a6b7..0aefc957cb 100644 --- a/client/src/routes/Root.tsx +++ b/client/src/routes/Root.tsx @@ -38,7 +38,8 @@ export default function Root() { useEffect(() => { if (modelsQuery.data) { setModelsConfig(modelsQuery.data); - newConversation(modelsQuery.data); + // Note: passing modelsQuery.data prevents navigation + newConversation({}, undefined, modelsQuery.data); } else if (modelsQuery.isError) { console.error('Failed to get models', modelsQuery.error); }