fix: remove window usage in not-found client (#20822)

* remove window usage in not-found client

* fix
This commit is contained in:
Benny Joo authored and GitHub committed 2025-04-22 16:04:36 +00:00
1 parent 9004dcb93b
commit 02fb7c0ae0
2 files changed
+4 -4

No files matched your search

+3 -1
View File
@@ -22,9 +22,11 @@ export const generateMetadata = async () => {
const ServerPage = async () => {
const h = await headers();
const nonce = h.get("x-nonce") ?? undefined;
const host = h.get("x-forwarded-host") ?? "";
return (
<PageWrapper requiresLicense={false} nonce={nonce}>
<NotFound />
<NotFound host={host} />
</PageWrapper>
);
};
+1 -3
View File
@@ -47,11 +47,9 @@ function getPageInfo(pathname: string, host: string) {
}
}
export function NotFound() {
export function NotFound({ host }: { host: string }) {
const { t } = useLocale();
const pathname = usePathname() ?? "";
const host = window.location.hostname;
const { username, pageType, url } = getPageInfo(pathname, host);
const isBookingSuccessPage = pathname?.startsWith("/booking");
const isSubpage = pathname?.includes("/", 2) || isBookingSuccessPage;