From 1f05d5428e984665e09d761291aa8dd8c1e23645 Mon Sep 17 00:00:00 2001 From: Jules BOURDAIS Date: Mon, 23 Dec 2024 10:04:34 +0100 Subject: [PATCH 1/3] refactor: format and cleanup component --- src/TrameIframeApp.tsx | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/src/TrameIframeApp.tsx b/src/TrameIframeApp.tsx index 44223dd..2fd9719 100644 --- a/src/TrameIframeApp.tsx +++ b/src/TrameIframeApp.tsx @@ -18,7 +18,7 @@ const TrameIframeApp: React.FC = iframe = document.getElementById(iframeId); if (iframe == null) { - throw new Error("iframe not found"); + throw new Error(`iframe ${iframeId} not found`); } const createClientCommunicator = () => { @@ -30,30 +30,26 @@ const TrameIframeApp: React.FC = return function unmount() { if (iframe) { - listeners.forEach((l) => iframe.removeEventListener("load", l)); + listeners.forEach((l) => iframe.removeEventListener("load", l)); } listeners = []; if (iframeClientCommunicator) { - iframeClientCommunicator.cleanup(); + iframeClientCommunicator.cleanup(); } }; }, []); - let content = null; - - if (url !== null) { - content =