mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix: close portal if main window closes
This commit is contained in:
@@ -101,6 +101,11 @@ class PreviewPortal extends Component<PreviewPortalProps> {
|
||||
});
|
||||
|
||||
this.props.storePortalWindow(this.externalWindow);
|
||||
|
||||
// close the portal if the main window closes
|
||||
this.mainWindow?.addEventListener('beforeunload', () => {
|
||||
this.externalWindow?.close();
|
||||
});
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
||||
Reference in New Issue
Block a user