Skip to content

Commit e5eebc5

Browse files
committed
fix: bug notfound page
1 parent b5599be commit e5eebc5

4 files changed

Lines changed: 17 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { notFound } from "next/navigation";
2+
3+
export default function CatchAllPage() {
4+
notFound();
5+
}

src/app/[locale]/not-found.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Note that `app/[locale]/[...rest]/page.tsx`
2+
// is necessary for this page to render.
3+
4+
export { default } from "@/components/layout/NotFoundPage";

src/app/not-found.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
"use client";
22

3-
import NotFoundPage from "@/components/layout/NotFoundPage";
3+
import Error from "next/error";
4+
5+
// This page renders when a route like `/unknown.txt` is requested.
6+
// In this case, the layout at `app/[locale]/layout.tsx` receives
7+
// an invalid value as the `[locale]` param and calls `notFound()`.
48

59
export default function GlobalNotFound() {
610
return (
711
<html lang="en">
8-
<body suppressHydrationWarning className="flex h-screen w-full items-center justify-center">
9-
<NotFoundPage />
12+
<body>
13+
<Error statusCode={404} />;
1014
</body>
1115
</html>
1216
);

src/components/layout/NotFoundPage/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Link from "next/link";
44

55
const NotFoundPage = () => {
66
return (
7-
<div className="flex flex-col items-center gap-6 text-center">
7+
<div className="flex h-screen w-full flex-col items-center justify-center gap-6 text-center">
88
<Image
99
src="/assets/images/illustrations/404.svg"
1010
alt="not-found"

0 commit comments

Comments
 (0)