Skip to content

Commit 9ed23a4

Browse files
authored
fix pathname was always _not-found in 404 page (#1637)
1 parent 874f8b4 commit 9ed23a4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

website/src/app/not-found.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
"use client"
22

33
import { usePathname } from "next/navigation"
4+
import { useMounted } from "nextra/hooks"
45

56
export default function Page() {
6-
const pathname = usePathname()?.replace(/\/$/, "")
7+
const pathname = usePathname()
8+
const mounted = useMounted()
79

810
const repo = {
911
origin: "https://github.com",
1012
owner: "graphql",
1113
name: "graphql.github.io",
1214
}
1315

14-
const title = `Found broken \`${pathname}\` link. Please fix!`
16+
const title = `Found broken \`${mounted ? pathname?.replace(/\/$/, "") : ""}\` link. Please fix!`
1517
const labels = "bug"
1618

1719
const url = `${repo.origin}/${repo.owner}/${

0 commit comments

Comments
 (0)