From 1ad6e1749fadbe6e2b8b103dbecee80af89ec73e Mon Sep 17 00:00:00 2001 From: sabaimran Date: Sat, 19 Oct 2024 20:36:13 -0700 Subject: [PATCH] Move window redirect to after relevant data is dropped in localStorage on the homage page One limitation of this methodology is that localStorage has a limit in how much data it can take. Should add more graceful error handling here as well. --- src/interface/web/app/page.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interface/web/app/page.tsx b/src/interface/web/app/page.tsx index 7002a340..4bc97bf1 100644 --- a/src/interface/web/app/page.tsx +++ b/src/interface/web/app/page.tsx @@ -138,11 +138,11 @@ function ChatBodyData(props: ChatBodyDataProps) { try { const newConversationId = await createNewConversation(selectedAgent || "khoj"); onConversationIdChange?.(newConversationId); - window.location.href = `/chat?conversationId=${newConversationId}`; localStorage.setItem("message", message); if (images.length > 0) { localStorage.setItem("images", JSON.stringify(images)); } + window.location.href = `/chat?conversationId=${newConversationId}`; } catch (error) { console.error("Error creating new conversation:", error); setProcessingMessage(false);