diff --git a/src/app/groups/[groupId]/expenses/page.tsx b/src/app/groups/[groupId]/expenses/page.tsx
index 0ec5086..5285cb8 100644
--- a/src/app/groups/[groupId]/expenses/page.tsx
+++ b/src/app/groups/[groupId]/expenses/page.tsx
@@ -7,11 +7,13 @@ import {
CardHeader,
CardTitle,
} from '@/components/ui/card'
+import { Skeleton } from '@/components/ui/skeleton'
import { getGroup, getGroupExpenses } from '@/lib/api'
import { Plus } from 'lucide-react'
import { Metadata } from 'next'
import Link from 'next/link'
import { notFound } from 'next/navigation'
+import { Suspense } from 'react'
export const metadata: Metadata = {
title: 'Expenses',
@@ -22,11 +24,6 @@ export default async function GroupExpensesPage({
}: {
params: { groupId: string }
}) {
- const group = await getGroup(groupId)
- if (!group) notFound()
-
- const expenses = await getGroupExpenses(groupId)
-
return (
@@ -46,13 +43,40 @@ export default async function GroupExpensesPage({
-
+ (
+
+ ))}
+ >
+
+
)
}
+
+async function Expenses({ groupId }: { groupId: string }) {
+ const group = await getGroup(groupId)
+ if (!group) notFound()
+ const expenses = await getGroupExpenses(group.id)
+
+ return (
+
+ )
+}
diff --git a/src/app/groups/recent-group-list.tsx b/src/app/groups/recent-group-list.tsx
index 60e3922..77feaf4 100644
--- a/src/app/groups/recent-group-list.tsx
+++ b/src/app/groups/recent-group-list.tsx
@@ -2,6 +2,7 @@
import { getGroupsAction } from '@/app/groups/actions'
import { getRecentGroups } from '@/app/groups/recent-groups-helpers'
import { Button } from '@/components/ui/button'
+import { Skeleton } from '@/components/ui/skeleton'
import { getGroups } from '@/lib/api'
import { Calendar, Loader2, Users } from 'lucide-react'
import Link from 'next/link'
@@ -96,9 +97,10 @@ export function RecentGroupList() {
) : (
- <>
-
- >
+
+
+
+
)}
diff --git a/src/components/ui/skeleton.tsx b/src/components/ui/skeleton.tsx
new file mode 100644
index 0000000..01b8b6d
--- /dev/null
+++ b/src/components/ui/skeleton.tsx
@@ -0,0 +1,15 @@
+import { cn } from "@/lib/utils"
+
+function Skeleton({
+ className,
+ ...props
+}: React.HTMLAttributes) {
+ return (
+
+ )
+}
+
+export { Skeleton }
diff --git a/src/lib/prisma.ts b/src/lib/prisma.ts
index 210e691..2886a89 100644
--- a/src/lib/prisma.ts
+++ b/src/lib/prisma.ts
@@ -3,6 +3,7 @@ import { PrismaClient } from '@prisma/client'
let prisma: PrismaClient
export async function getPrisma() {
+ // await delay(1000)
if (!prisma) {
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient()