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