File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useReducer } from 'react' ;
1+ import React , { useEffect , useReducer } from 'react' ;
22import './App.css' ;
33import ReactTooltip from 'react-tooltip' ;
44import GraphWorkspace from './GraphWorkspace' ;
@@ -15,6 +15,16 @@ import FileEditModal from './component/modals/FileEdit';
1515
1616const app = ( ) => {
1717 const [ superState , dispatcher ] = useReducer ( reducer , initialState ) ;
18+ useEffect ( ( ) => {
19+ const handleBeforeUnload = ( e ) => {
20+ e . returnValue = 'Are you sure you want to leave this page?' ;
21+ return 'Are you sure you want to leave this page?' ;
22+ } ;
23+ window . onbeforeunload = handleBeforeUnload ;
24+ return ( ) => {
25+ window . onbeforeunload = null ;
26+ } ;
27+ } , [ ] ) ;
1828 return (
1929 < div className = "container" >
2030 < ProjectDetails superState = { superState } dispatcher = { dispatcher } />
You can’t perform that action at this time.
0 commit comments