Skip to content

Commit

Permalink
add extra time to send contract data to iframe
Browse files Browse the repository at this point in the history
  • Loading branch information
MCarlomagno committed Dec 9, 2024
1 parent 7c73a17 commit fb3553c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/ui/src/post-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

0 comments on commit fb3553c

Please sign in to comment.