aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/web/app/(auth)/onboarding/page.tsx2
-rw-r--r--apps/web/app/(dash)/home/filterSpaces.tsx4
-rw-r--r--apps/web/app/(dash)/home/history.tsx4
-rw-r--r--apps/web/app/actions/doers.ts18
-rw-r--r--apps/web/app/api/store/route.ts20
-rw-r--r--packages/ui/shadcn/combobox.tsx4
6 files changed, 26 insertions, 26 deletions
diff --git a/apps/web/app/(auth)/onboarding/page.tsx b/apps/web/app/(auth)/onboarding/page.tsx
index 9728d107..653090a0 100644
--- a/apps/web/app/(auth)/onboarding/page.tsx
+++ b/apps/web/app/(auth)/onboarding/page.tsx
@@ -10,7 +10,7 @@ import { CheckIcon, PlusCircleIcon } from "@heroicons/react/24/outline";
import { motion } from "framer-motion";
import { useEffect, useState } from "react";
import { toast } from "sonner";
-import { completeOnboarding, createMemory } from "@repo/web/app/actions/doers";
+import { completeOnboarding, createMemory } from "@/app/actions/doers";
import { useRouter } from "next/navigation";
import Logo from "../../../public/logo.svg";
import Image from "next/image";
diff --git a/apps/web/app/(dash)/home/filterSpaces.tsx b/apps/web/app/(dash)/home/filterSpaces.tsx
index 9896141c..1208fd17 100644
--- a/apps/web/app/(dash)/home/filterSpaces.tsx
+++ b/apps/web/app/(dash)/home/filterSpaces.tsx
@@ -62,7 +62,9 @@ export function FilterSpaces({
placeholder={selectedSpaces.length ? "" : "Search in Spaces"}
onKeyDown={handleKeyDown}
className="text-white peer placeholder:text-white"
- onChangeCapture={(e) => setInput(e.currentTarget.value)}
+ onChangeCapture={(e: React.ChangeEvent<HTMLInputElement>) =>
+ setInput(e.target.value)
+ }
value={input}
/>
</div>
diff --git a/apps/web/app/(dash)/home/history.tsx b/apps/web/app/(dash)/home/history.tsx
index 307ef4e3..6b8d23de 100644
--- a/apps/web/app/(dash)/home/history.tsx
+++ b/apps/web/app/(dash)/home/history.tsx
@@ -1,12 +1,8 @@
-import { getChatHistory } from "@repo/web/app/actions/fetchers";
import { ArrowLongRightIcon } from "@heroicons/react/24/outline";
import { Skeleton } from "@repo/ui/shadcn/skeleton";
-import Link from "next/link";
import { memo, useEffect, useState } from "react";
import { motion } from "framer-motion";
-import { chatThreads } from "@/server/db/schema";
import { getQuerySuggestions } from "@/app/actions/doers";
-import { Button } from "@repo/ui/shadcn/button";
const History = memo(({ setQuery }: { setQuery: (q: string) => void }) => {
const [suggestions, setSuggestions] = useState<string[] | null>(null);
diff --git a/apps/web/app/actions/doers.ts b/apps/web/app/actions/doers.ts
index fbccd195..311ce9a8 100644
--- a/apps/web/app/actions/doers.ts
+++ b/apps/web/app/actions/doers.ts
@@ -288,7 +288,7 @@ export const createMemory = async (input: {
};
}
- let contentId: number | undefined;
+ let contentId: number;
const response = (await vectorSaveResponse.json()) as {
status: string;
@@ -345,6 +345,14 @@ export const createMemory = async (input: {
revalidatePath("/memories");
revalidatePath("/home");
+ if (!insertResponse[0]?.id) {
+ return {
+ success: false,
+ data: 0,
+ error: "Something went wrong while saving the document to the database",
+ };
+ }
+
contentId = insertResponse[0]?.id;
} catch (e) {
const error = e as Error;
@@ -369,14 +377,6 @@ export const createMemory = async (input: {
};
}
- if (!contentId) {
- return {
- success: false,
- data: 0,
- error: "Something went wrong while saving the document to the database",
- };
- }
-
if (storeToSpaces.length > 0) {
// Adding the many-to-many relationship between content and spaces
const spaceData = await db
diff --git a/apps/web/app/api/store/route.ts b/apps/web/app/api/store/route.ts
index f9ab7c01..317b5e83 100644
--- a/apps/web/app/api/store/route.ts
+++ b/apps/web/app/api/store/route.ts
@@ -52,7 +52,7 @@ const createMemoryFromAPI = async (input: {
};
}
- let contentId: number | undefined;
+ let contentId: number;
const saveToDbUrl =
(input.data.url.split("#supermemory-user-")[0] ?? input.data.url) +
@@ -79,7 +79,15 @@ const createMemoryFromAPI = async (input: {
})
.returning({ id: storedContent.id });
- contentId = insertResponse[0]?.id;
+ if (!insertResponse[0]?.id) {
+ return {
+ success: false,
+ data: 0,
+ error: "Failed to save to database",
+ };
+ }
+
+ contentId = insertResponse[0].id;
} catch (e) {
const error = e as Error;
console.log("Error: ", error.message);
@@ -99,14 +107,6 @@ const createMemoryFromAPI = async (input: {
};
}
- if (!contentId) {
- return {
- success: false,
- data: 0,
- error: "Failed to save to database",
- };
- }
-
if (input.data.spaces.length > 0) {
// Adding the many-to-many relationship between content and spaces
const spaceData = await db
diff --git a/packages/ui/shadcn/combobox.tsx b/packages/ui/shadcn/combobox.tsx
index 81019b10..080a3485 100644
--- a/packages/ui/shadcn/combobox.tsx
+++ b/packages/ui/shadcn/combobox.tsx
@@ -45,7 +45,9 @@ const ComboboxWithCreate: React.FC<ComboboxWithCreateProps> = ({
return (
<Command className={cn("group", className)}>
<CommandInput
- onChangeCapture={(e) => setInputValue(e.currentTarget.value)}
+ onChangeCapture={(e: React.ChangeEvent<HTMLInputElement>) =>
+ setInputValue(e.currentTarget.value)
+ }
placeholder={placeholder}
value={inputValue}
/>