From 53b761b4c178d6ff1fe38570d860a22c08cf3538 Mon Sep 17 00:00:00 2001 From: gregfromstl Date: Tue, 6 May 2025 13:03:54 -0700 Subject: [PATCH] fix: checkout error boundary --- apps/dashboard/src/app/checkout/error.tsx | 28 ++++++++++++++++++++++ apps/dashboard/src/app/checkout/layout.tsx | 16 +++++++++++-- apps/dashboard/src/app/checkout/page.tsx | 28 +++++++--------------- 3 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 apps/dashboard/src/app/checkout/error.tsx diff --git a/apps/dashboard/src/app/checkout/error.tsx b/apps/dashboard/src/app/checkout/error.tsx new file mode 100644 index 00000000000..0f38e50e422 --- /dev/null +++ b/apps/dashboard/src/app/checkout/error.tsx @@ -0,0 +1,28 @@ +"use client"; // Error boundaries must be Client Components + +import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; +import { useEffect } from "react"; + +export default function ErrorPage({ + error, +}: { + error: Error & { digest?: string }; +}) { + useEffect(() => { + // Log the error to an error reporting service + console.error(error); + }, [error]); + + return ( + + + + Something went wrong + + + + {error.message} + + + ); +} diff --git a/apps/dashboard/src/app/checkout/layout.tsx b/apps/dashboard/src/app/checkout/layout.tsx index c21155f94c0..22386b2ce56 100644 --- a/apps/dashboard/src/app/checkout/layout.tsx +++ b/apps/dashboard/src/app/checkout/layout.tsx @@ -1,3 +1,4 @@ +import "../../global.css"; import { cn } from "@/lib/utils"; import { ThemeProvider } from "next-themes"; import { Inter } from "next/font/google"; @@ -23,11 +24,22 @@ export default function CheckoutLayout({ > - {children} +
+
+ {children} +
+ + {/* eslint-disable-next-line @next/next/no-img-element */} + +
diff --git a/apps/dashboard/src/app/checkout/page.tsx b/apps/dashboard/src/app/checkout/page.tsx index ebdde336e67..706c3a1a426 100644 --- a/apps/dashboard/src/app/checkout/page.tsx +++ b/apps/dashboard/src/app/checkout/page.tsx @@ -1,4 +1,3 @@ -import "../../global.css"; import { getThirdwebClient } from "@/constants/thirdweb.server"; import type { Metadata } from "next"; import { createThirdwebClient, defineChain, getContract } from "thirdweb"; @@ -73,24 +72,13 @@ export default async function RoutesPage({ }; return ( -
-
- -
- - {/* eslint-disable-next-line @next/next/no-img-element */} - -
+ ); }