Skip to content

Commit

Permalink
馃獰 馃悰 Fix issue with opener window closed (#22107)
Browse files Browse the repository at this point in the history
* Fix issue with opener window closed

* Close popup tab on original close
  • Loading branch information
timroes committed Jan 31, 2023
1 parent 92c1a23 commit 860dd1c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion airbyte-webapp/src/hooks/services/useConnectorAuth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,13 @@ export function useRunOauthFlow(
[completeOauth]
);

const onCloseWindow = useCallback(() => {
windowObjectReference?.close();
}, []);

useEvent("message", onOathGranted);
// Close popup oauth window when we close the original tab
useEvent("beforeunload", onCloseWindow);

return {
loading: loadingCompleteOauth || loading,
Expand All @@ -210,7 +216,7 @@ export function useResolveNavigate(): void {
const query = useQuery();

useEffectOnce(() => {
window.opener.postMessage(query);
window.opener?.postMessage(query);
window.close();
});
}

0 comments on commit 860dd1c

Please sign in to comment.