Skip to content

Commit efe057e

Browse files
authored
fix: correctly pass modelsData to newConversation, also prevent navigation in this case (danny-avila#1162)
1 parent 5ab9802 commit efe057e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

client/src/hooks/useConversation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const useConversation = () => {
5151
setSubmission({} as TSubmission);
5252
resetLatestMessage();
5353

54-
if (conversation.conversationId === 'new') {
54+
if (conversation.conversationId === 'new' && !modelsData) {
5555
navigate('/chat/new');
5656
}
5757
},

client/src/routes/Root.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export default function Root() {
3838
useEffect(() => {
3939
if (modelsQuery.data) {
4040
setModelsConfig(modelsQuery.data);
41-
newConversation(modelsQuery.data);
41+
// Note: passing modelsQuery.data prevents navigation
42+
newConversation({}, undefined, modelsQuery.data);
4243
} else if (modelsQuery.isError) {
4344
console.error('Failed to get models', modelsQuery.error);
4445
}

0 commit comments

Comments
 (0)