Skip to content

Scheduling infrastructure for absolutely everyone.

fix: guard against document being undefined in embed-iframe informAboutScroll (#28596)

Sahitya Chandrab436f331c79f
diff --git a/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts b/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts
index 1884b952250..f8a70d68eba 100644
--- a/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts
+++ b/packages/embeds/embed-core/src/embed-iframe/lib/utils.ts
@@ -66,6 +66,10 @@ export function keepParentInformedAboutDimensionChanges({ embedStore }: { embedS
let isInitialDimensionPass = true;
let isWindowLoadComplete = false;
runAsap(function informAboutScroll() {
+ // Can't inform parent about dimensions if document doesn't exist
+ if (typeof document === "undefined") {
+ return;
+ }
if (document.readyState !== "complete") {
// Wait for window to load to correctly calculate the initial scroll height.
runAsap(informAboutScroll);