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>
This commit is contained in:
1 parent
945ded951f
commit
71792bdeaa
4 files changed
+61
-36
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { useLayoutEffect } from "react";
|
||||
|
||||
import "@calcom/embed-core/src/embed-iframe";
|
||||
import { HttpError } from "@calcom/lib/http-error";
|
||||
@@ -59,6 +59,14 @@ export const ErrorPage: React.FC<Props> = (props) => {
|
||||
window.location.reload();
|
||||
props.reset?.();
|
||||
};
|
||||
|
||||
// useLayoutEffect runs synchronously before browser paint, ensuring it's set early
|
||||
useLayoutEffect(() => {
|
||||
if (statusCode && typeof window !== "undefined") {
|
||||
window.CalComPageStatus = statusCode.toString();
|
||||
}
|
||||
}, [statusCode]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="bg-subtle flex h-screen">
|
||||
|
||||
Reference in new issue
Block a user