From 02fb7c0ae0315f08a1a4a47b394b3d14c6616d97 Mon Sep 17 00:00:00 2001 From: Benny Joo Date: Tue, 22 Apr 2025 13:04:36 -0300 Subject: [PATCH] fix: remove window usage in not-found client (#20822) * remove window usage in not-found client * fix --- apps/web/app/not-found.tsx | 4 +++- apps/web/app/notFoundClient.tsx | 4 +--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx index 3a901b6440..fbd9529d92 100644 --- a/apps/web/app/not-found.tsx +++ b/apps/web/app/not-found.tsx @@ -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 ( - + ); }; diff --git a/apps/web/app/notFoundClient.tsx b/apps/web/app/notFoundClient.tsx index 733930657d..0b7173ba09 100644 --- a/apps/web/app/notFoundClient.tsx +++ b/apps/web/app/notFoundClient.tsx @@ -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;