93f7061c53
- Fix TypeScript type error in deleteInvoice server action (returned
{message: string} instead of void, incompatible with form action type)
- Add export const dynamic = "force-dynamic" to dashboard pages that
make DB calls at build time (/dashboard, /dashboard/invoices,
/dashboard/invoices/create) to prevent failed static prerendering
- Fix import order in customers/page.tsx (export before import was invalid)
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
46 lines
1.4 KiB
TypeScript
46 lines
1.4 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { Suspense } from "react";
|
|
import { fetchInvoicesPages } from "@/app/lib/data";
|
|
import { lusitana } from "@/app/ui/fonts";
|
|
import { CreateInvoice } from "@/app/ui/invoices/buttons";
|
|
import Pagination from "@/app/ui/invoices/pagination";
|
|
import Table from "@/app/ui/invoices/table";
|
|
import Search from "@/app/ui/search";
|
|
import { InvoicesTableSkeleton } from "@/app/ui/skeletons";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
export const metadata: Metadata = {
|
|
title: "Invoices",
|
|
};
|
|
|
|
export default async function Page(props: {
|
|
searchParams?: Promise<{
|
|
query?: string;
|
|
page?: string;
|
|
}>;
|
|
}) {
|
|
const searchParams = await props.searchParams;
|
|
const query = searchParams?.query || "";
|
|
const currentPage = Number(searchParams?.page) || 1;
|
|
const totalPages = await fetchInvoicesPages(query);
|
|
|
|
return (
|
|
<div className="w-full">
|
|
<div className="flex w-full items-center justify-between">
|
|
<h1 className={`${lusitana.className} text-2xl`}>Invoices</h1>
|
|
</div>
|
|
<div className="mt-4 flex items-center justify-between gap-2 md:mt-8">
|
|
<Search {...Search} />
|
|
<CreateInvoice />
|
|
</div>
|
|
<Suspense key={query + currentPage} fallback={<InvoicesTableSkeleton />}>
|
|
<Table query={query} currentPage={currentPage} />
|
|
</Suspense>
|
|
<div className="mt-5 flex w-full justify-center">
|
|
<Pagination totalPages={totalPages} />
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|