Skip to content

Scheduling infrastructure for absolutely everyone.

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

Benny Joo02fb7c0ae031
diff --git a/apps/web/app/not-found.tsx b/apps/web/app/not-found.tsx
index 3a901b64404..fbd9529d926 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 (
<PageWrapper requiresLicense={false} nonce={nonce}>
- <NotFound />
+ <NotFound host={host} />
</PageWrapper>
);
};
diff --git a/apps/web/app/notFoundClient.tsx b/apps/web/app/notFoundClient.tsx
index 733930657dc..0b7173ba09c 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;