mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Made offers iframe init load async (#19516)
no issue - ensures it waits for event data to load before rendering the iframe which sometimes causes an undesired flashing experience.
This commit is contained in:
parent
66238c7ccf
commit
14bf2df834
@ -19,19 +19,19 @@ const PortalFrame: React.FC<PortalFrameProps> = ({href, onDestroyed, selectedTab
|
||||
if (iframeRef.current) {
|
||||
setIsInvisible(false);
|
||||
}
|
||||
}, 100); // Delay to allow scripts to render
|
||||
}, 200); // Delay to allow scripts to render
|
||||
}, [iframeRef]); // Dependencies for useCallback
|
||||
|
||||
// Effect for attaching message listener
|
||||
useEffect(() => {
|
||||
const messageListener = (event: MessageEvent) => {
|
||||
const messageListener = async (event: MessageEvent) => {
|
||||
if (!href) {
|
||||
return;
|
||||
}
|
||||
const originURL = new URL(event.origin);
|
||||
|
||||
if (originURL.origin === new URL(href).origin) {
|
||||
if (event.data === 'portal-ready' || event.data.type === 'portal-ready') {
|
||||
if (await event.data === 'portal-ready' || await event.data.type === 'portal-ready') {
|
||||
makeVisible();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user