From 0ec21f4f8f41dee991ff85a6ff8dbc1dd53b6714 Mon Sep 17 00:00:00 2001 From: codetorso Date: Fri, 9 Aug 2024 02:37:11 +0530 Subject: [PATCH 1/2] memory queue fix --- apps/web/app/(dash)/menu.tsx | 42 ++++++++++++++---------------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index b8bd25cc..3dc47630 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -135,12 +135,25 @@ function Menu() { richColors: true, }); } else { - toast.error(`Memory creation failed: ${cont.error}`); throw new Error(`Memory creation failed: ${cont.error}`); return cont; } }; + const formSubmit = () => { + toast.promise(handleSubmit(content, selectedSpaces), { + loading: ( + + {" "} + Creating memory... + + ), + success: (data) => "Memory queued", + error: (error) => `Memory creation failed: ${error}`, + richColors: true, + }); + } + return ( <> {/* Desktop Menu */} @@ -191,20 +204,7 @@ function Menu() {
{ - const content = e.get("content")?.toString(); - toast.promise(handleSubmit(content, selectedSpaces), { - loading: ( - - {" "} - Creating memory... - - ), - success: (data) => "Memory queued", - error: (error) => error.message, - richColors: true, - }); - }} + action={formSubmit} className="flex flex-col gap-4 " > @@ -227,17 +227,7 @@ function Menu() { onKeyDown={(e) => { if (e.key === "Enter" && !e.shiftKey) { e.preventDefault(); - toast.promise(handleSubmit(content, selectedSpaces), { - loading: ( - - {" "} - Creating memory... - - ), - success: (data) => "Memory created", - error: (error) => error.message, - richColors: true, - }); + formSubmit(); } }} /> From c36bd93182815dd684c2d940b511bad4db265edb Mon Sep 17 00:00:00 2001 From: codetorso Date: Fri, 9 Aug 2024 02:49:18 +0530 Subject: [PATCH 2/2] one more commit needed --- apps/web/app/(dash)/menu.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx index 3dc47630..bdc1aa8a 100644 --- a/apps/web/app/(dash)/menu.tsx +++ b/apps/web/app/(dash)/menu.tsx @@ -130,14 +130,7 @@ function Menu() { }); setContent(""); setSelectedSpaces([]); - if (cont.success) { - toast.success("Memory queued", { - richColors: true, - }); - } else { - throw new Error(`Memory creation failed: ${cont.error}`); - return cont; - } + return cont; }; const formSubmit = () => { @@ -152,7 +145,7 @@ function Menu() { error: (error) => `Memory creation failed: ${error}`, richColors: true, }); - } + }; return ( <> @@ -203,10 +196,7 @@ function Menu() { - + Add memory