From 9ed23a43dc34591c5ec8bfb166fbc1447f19e5e5 Mon Sep 17 00:00:00 2001 From: Dimitri POSTOLOV Date: Thu, 28 Mar 2024 13:10:04 +0100 Subject: [PATCH] fix `pathname` was always `_not-found` in `404` page (#1637) --- website/src/app/not-found.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/website/src/app/not-found.tsx b/website/src/app/not-found.tsx index 8dd4cc1662..5b3c11cd2e 100644 --- a/website/src/app/not-found.tsx +++ b/website/src/app/not-found.tsx @@ -1,9 +1,11 @@ "use client" import { usePathname } from "next/navigation" +import { useMounted } from "nextra/hooks" export default function Page() { - const pathname = usePathname()?.replace(/\/$/, "") + const pathname = usePathname() + const mounted = useMounted() const repo = { origin: "https://github.com", @@ -11,7 +13,7 @@ export default function Page() { name: "graphql.github.io", } - const title = `Found broken \`${pathname}\` link. Please fix!` + const title = `Found broken \`${mounted ? pathname?.replace(/\/$/, "") : ""}\` link. Please fix!` const labels = "bug" const url = `${repo.origin}/${repo.owner}/${