diff --git a/apps/web/app/(canvas)/canvas/[id]/page.tsx b/apps/web/app/(canvas)/canvas/[id]/page.tsx
index e58ab35e..6efb6cf4 100644
--- a/apps/web/app/(canvas)/canvas/[id]/page.tsx
+++ b/apps/web/app/(canvas)/canvas/[id]/page.tsx
@@ -9,11 +9,15 @@ import { AutocompleteIcon, blockIcon } from "@repo/ui/icons";
import Image from "next/image";
import { Switch } from "@repo/ui/shadcn/switch";
import { Label } from "@repo/ui/shadcn/label";
+import { useRouter } from "next/router";
function page() {
const [fullScreen, setFullScreen] = useState(false);
const [visible, setVisible] = useState(true);
+ const router = useRouter();
+ router.push("/home");
+
return (
page
- )
+ const router = useRouter();
+ router.push("/home");
+ return page
;
}
-export default page
\ No newline at end of file
+export default page;
diff --git a/apps/web/app/actions/fetchers.ts b/apps/web/app/actions/fetchers.ts
index 708b82b2..0746096c 100644
--- a/apps/web/app/actions/fetchers.ts
+++ b/apps/web/app/actions/fetchers.ts
@@ -85,68 +85,13 @@ export const getAllUserMemoriesAndSpaces = async (): ServerActionReturnType<{
where: eq(users, data.user.id),
});
- const spacesWithoutUser = spaces.map((space) => {
- return { ...space, user: undefined };
+ const memories = await db.query.storedContent.findMany({
+ where: eq(users, data.user.id),
});
- // const contentCountBySpace = await db
- // .select({
- // spaceId: contentToSpace.spaceId,
- // count: sql`count(*)`.mapWith(Number),
- // })
- // .from(contentToSpace)
- // .where(
- // inArray(
- // contentToSpace.spaceId,
- // spacesWithoutUser.map((space) => space.id),
- // ),
- // )
- // .groupBy(contentToSpace.spaceId)
- // .execute();
-
- // console.log(contentCountBySpace);
-
- // get a count with space mappings like spaceID: count (number of memories in that space)
-
- const len = spacesWithoutUser.map((space) => space.id).length;
-
- if (len > 0) {
- const contentCountBySpace = await db
- .select({
- spaceId: contentToSpace.spaceId,
- count: sql`count(*)`.mapWith(Number),
- })
- .from(contentToSpace)
- .where(
- inArray(
- contentToSpace.spaceId,
- spacesWithoutUser.map((space) => space.id),
- ),
- )
- .groupBy(contentToSpace.spaceId)
- .execute();
-
- console.log(contentCountBySpace);
- }
-
- const contentNotInAnySpace = await db
- .select()
- .from(storedContent)
- .where(
- not(
- eq(
- storedContent.id,
- db
- .select({ contentId: contentToSpace.contentId })
- .from(contentToSpace),
- ),
- ),
- )
- .execute();
-
return {
success: true,
- data: { spaces: spacesWithoutUser, memories: contentNotInAnySpace },
+ data: { spaces: spaces, memories: memories },
};
};