Somehow removed this window.close code

Bring it back + focus() for opener window
This commit is contained in:
Lim Chee Aun 2022-12-16 13:54:17 +08:00
parent ec0b76901a
commit e09e1f16cd

View file

@ -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 (
<div class="box">
@ -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) {}
}}
/>