From fb3553cf386be45e6a273a4710aff08d1d3cd99e Mon Sep 17 00:00:00 2001 From: Marcos Date: Mon, 9 Dec 2024 10:12:31 -0300 Subject: [PATCH] add extra time to send contract data to iframe --- packages/ui/src/post-message.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/post-message.ts b/packages/ui/src/post-message.ts index 9f51cef2..63d09897 100644 --- a/packages/ui/src/post-message.ts +++ b/packages/ui/src/post-message.ts @@ -31,9 +31,12 @@ export function postMessageToIframe(id: 'defender-deploy', msg: Message) { var iframe: HTMLIFrameElement | null = document.getElementById(id) as HTMLIFrameElement; if (iframe) { iframe.contentWindow?.postMessage(msg, '*'); - // in case the iframe is still loading + // in case the iframe is still loading, waits + // a second to fully load and tries again iframe.onload = () => { - iframe?.contentWindow?.postMessage(msg, '*'); + setTimeout(() => { + iframe?.contentWindow?.postMessage(msg, '*'); + }, 1000); } } }