-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues found in electron testing. #7494
- Loading branch information
1 parent
64d7c2c
commit 8e16e00
Showing
4 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
web/pgadmin/tools/erd/static/js/erd_tool/components/BeforeUnload.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
import React from 'react'; | ||
import React, { useEffect } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { useBeforeUnload } from '../../../../../../static/js/custom_hooks'; | ||
|
||
export default function BeforeUnload({enabled, isNewTab, beforeClose, closePanel}) { | ||
useBeforeUnload( | ||
export default function BeforeUnload({onInit, enabled, isNewTab, beforeClose, closePanel}) { | ||
const init = useBeforeUnload( | ||
{enabled, isNewTab, beforeClose, closePanel} | ||
); | ||
|
||
useEffect(()=>{ | ||
onInit?.(init); | ||
}, [init]); | ||
|
||
return <></>; | ||
} | ||
|
||
BeforeUnload.propTypes = { | ||
onInit: PropTypes.func, | ||
enabled: PropTypes.bool, | ||
isNewTab: PropTypes.bool, | ||
beforeClose: PropTypes.func, | ||
closePanel: PropTypes.func, | ||
getForceClose: PropTypes.func, | ||
closePanel: PropTypes.func | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters