1
0
Fork 0
mirror of https://github.com/khoj-ai/khoj.git synced 2025-02-18 23:54:20 +00:00

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.
This commit is contained in:
sabaimran 2024-10-19 20:36:13 -07:00
parent cb6b3ec1e9
commit 1ad6e1749f

View file

@ -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);