From 14bf2df8341f98874b71b50e3240bf30b608332e Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Thu, 18 Jan 2024 12:38:41 +0000 Subject: [PATCH] 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. --- .../components/settings/membership/portal/PortalFrame.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/membership/portal/PortalFrame.tsx b/apps/admin-x-settings/src/components/settings/membership/portal/PortalFrame.tsx index e75c0dcd6b..267cfc8d07 100644 --- a/apps/admin-x-settings/src/components/settings/membership/portal/PortalFrame.tsx +++ b/apps/admin-x-settings/src/components/settings/membership/portal/PortalFrame.tsx @@ -19,19 +19,19 @@ const PortalFrame: React.FC = ({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(); } }