Skip to content

Commit 5df6606

Browse files
authored
fix 404 report host and pathname (#10893)
* fix 404 report path * dynamic host
1 parent 1e3ca89 commit 5df6606

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/not-found.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
'use client';
22

3+
import {useEffect, useState} from 'react';
34
import {Button} from '@radix-ui/themes';
4-
import {usePathname} from 'next/navigation';
55

66
import {Header} from 'sentry-docs/components/header';
77
import {Search} from 'sentry-docs/components/search';
88

99
export default function NotFound() {
10-
const pathname = usePathname() ?? '/';
11-
const brokenUrl = `https://docs.sentry.io${pathname}`;
10+
const [pathname, setPathname] = useState('');
11+
const [host, setHost] = useState('');
12+
useEffect(() => {
13+
setPathname(window.location.pathname);
14+
setHost(window.location.host);
15+
}, []);
16+
const brokenUrl = `${host}${pathname}`;
1217
const reportUrl = `https://github.com/getsentry/sentry-docs/issues/new?template=issue-platform-404.yml&title=🔗 404 Error&url=${brokenUrl}`;
1318
return (
1419
<div className="tw-app">

0 commit comments

Comments
 (0)