Skip to content

Commit 6607232

Browse files
committed
Using setTimeout loads the iframe more reliably
1 parent 4022c30 commit 6607232

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

frontend/app.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export function renderBlock(containerId: string, props: BlockProps) {
1919
};
2020

2121
const element = createElement(Block, blockProps);
22-
render(element, document.getElementById(containerId));
22+
setTimeout( function() {
23+
render(element, document.getElementById(containerId));
24+
}, 1 );
2325
}
2426

2527
export type PopupProps = Omit<BasePopupProps, "iframeUrl">;

frontend/block/view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ declare global {
99
}
1010
}
1111

12-
window.addEventListener('load', () => {
12+
window.addEventListener('DOMContentLoaded', () => {
1313
const config = window.ChatrixBlockConfig;
1414
if (!config) {
1515
throw "ChatrixBlockConfig is not defined";

0 commit comments

Comments
 (0)