Skip to content

Commit 85df7b0

Browse files
committed
Move setTimeout to view.ts
1 parent 6607232 commit 85df7b0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

frontend/app.ts

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

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

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

frontend/block/view.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ window.addEventListener('DOMContentLoaded', () => {
2525
attributes: config.attributes,
2626
};
2727

28-
renderBlock(containerId, props);
28+
// See https://github.com/Automattic/chatrix/issues/161 for why we use a timeout here.
29+
setTimeout( () => renderBlock(containerId, props), 1 );
2930
});

0 commit comments

Comments
 (0)