Files
calendar/apps/web/components/PageWrapperAppDir.tsx
T
Hariom BalharaGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
71792bdeaa fix: ensure linkFailed event fires for 404, 500, and 403 errors in embeds (#25261)
- Add CalComPageStatus handling in NotFound and ErrorPage components using useLayoutEffect
- Remove redundant pageStatus logic from PageWrapperAppDir.tsx since App Router error/notFound pages set status themselves
- Refactor embed-iframe.ts: split checkPageStatusAndHandleError into hasPageError() and handlePageError()
- Add page status checks before firing linkReady to catch errors set after initialization
- Ensures linkFailed event fires correctly for all error status codes in embed scenarios

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-12-18 16:30:32 +00:00

43 lines
1.3 KiB
TypeScript

"use client";
import "@calcom/embed-core/src/embed-iframe";
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import AppProviders from "@lib/app-providers-app-dir";
export type PageWrapperProps = Readonly<{
children: React.ReactNode;
requiresLicense: boolean;
nonce: string | undefined;
isBookingPage?: boolean;
}>;
function PageWrapper(props: PageWrapperProps) {
// On client side don't let nonce creep into DOM
// It also avoids hydration warning that says that Client has the nonce value but server has "" because browser removes nonce attributes before DOM is built
// See https://github.com/kentcdodds/nonce-hydration-issues
// Set "" only if server had it set otherwise keep it undefined because server has to match with client to avoid hydration error
const nonce = typeof window !== "undefined" ? (props.nonce ? "" : undefined) : props.nonce;
const providerProps: PageWrapperProps = {
...props,
nonce,
};
return (
<>
<AppProviders {...providerProps}>
<>
{props.requiresLicense ? (
<LicenseRequired>{props.children}</LicenseRequired>
) : (
<>{props.children}</>
)}
</>
</AppProviders>
</>
);
}
export default PageWrapper;