fix: resolve build failures
- 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>
This commit is contained in:
@@ -10,6 +10,8 @@ import {
|
||||
RevenueChartSkeleton,
|
||||
} from "@/app/ui/skeletons";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Dashboard",
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
export default function Page() {
|
||||
return <p>Customers Page</p>;
|
||||
}
|
||||
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Customers",
|
||||
};
|
||||
|
||||
export default function Page() {
|
||||
return <p>Customers Page</p>;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import { fetchCustomers } from "@/app/lib/data";
|
||||
import Breadcrumbs from "@/app/ui/invoices/breadcrumbs";
|
||||
import Form from "@/app/ui/invoices/create-form";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Create invoices",
|
||||
};
|
||||
|
||||
@@ -8,6 +8,8 @@ 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",
|
||||
};
|
||||
|
||||
+2
-5
@@ -103,7 +103,7 @@ export async function updateInvoice(
|
||||
redirect("/dashboard/invoices");
|
||||
}
|
||||
|
||||
export async function deleteInvoice(id: string) {
|
||||
export async function deleteInvoice(id: string): Promise<void> {
|
||||
// throw new Error('Failed to Delete Invoice. ')
|
||||
try {
|
||||
await sql`
|
||||
@@ -111,11 +111,8 @@ export async function deleteInvoice(id: string) {
|
||||
WHERE id = ${id}
|
||||
`;
|
||||
revalidatePath("/dashboard/invoices");
|
||||
return { message: "Deleted Invoice. " };
|
||||
} catch (_error) {
|
||||
return {
|
||||
message: "Database Error: Failed while deleting record from Invoice. ",
|
||||
};
|
||||
console.error("Database Error: Failed while deleting record from Invoice.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user