From e09e1f16cdfdfe215a22d681dbeaf0e65bfaf97a Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 16 Dec 2022 13:54:17 +0800 Subject: [PATCH 1/2] Somehow removed this window.close code Bring it back + focus() for opener window --- src/compose.jsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/compose.jsx b/src/compose.jsx index cdf13a88..b7bb30ba 100644 --- a/src/compose.jsx +++ b/src/compose.jsx @@ -52,6 +52,16 @@ function App() { : 'Compose', ); + useEffect(() => { + if (uiState === 'closed') { + try { + // Focus parent window + window.opener.focus(); + } catch (e) {} + window.close(); + } + }, [uiState]); + if (uiState === 'closed') { return (
@@ -79,11 +89,13 @@ function App() { onClose={(results) => { const { newStatus, fn = () => {} } = results || {}; try { + console.log('onClose', newStatus, fn); if (newStatus) { window.opener.__STATES__.reloadStatusPage++; } fn(); setUIState('closed'); + window.close(); } catch (e) {} }} /> From f89622570764fe25d9094b3a8a4636f74a03e6c8 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Fri, 16 Dec 2022 13:58:13 +0800 Subject: [PATCH 2/2] Hmm remove debugging --- src/compose.jsx | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/compose.jsx b/src/compose.jsx index b7bb30ba..88fa3990 100644 --- a/src/compose.jsx +++ b/src/compose.jsx @@ -89,13 +89,11 @@ function App() { onClose={(results) => { const { newStatus, fn = () => {} } = results || {}; try { - console.log('onClose', newStatus, fn); if (newStatus) { window.opener.__STATES__.reloadStatusPage++; } fn(); setUIState('closed'); - window.close(); } catch (e) {} }} />