From beab08bdd33c0b8b0f3b2f2a77e21db50ad099aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ali=20Kire=C3=A7lig=C3=B6l?= Date: Tue, 16 Jul 2024 15:12:59 +0300 Subject: [PATCH] fix unloadFlow (#131) --- packages/web-embed-api/src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/web-embed-api/src/index.ts b/packages/web-embed-api/src/index.ts index 541506b..cf6ab54 100644 --- a/packages/web-embed-api/src/index.ts +++ b/packages/web-embed-api/src/index.ts @@ -59,8 +59,10 @@ const FormsortWebEmbed = ( const unloadFlow = () => { removeListeners(); - if (iframeEl.contentDocument) { + try { rootEl.removeChild(iframeEl); + } catch (e) { + // noop: iframe already removed OR blur event triggered by iframe removal } };