File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
src/projects/create/containers Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -93,9 +93,10 @@ class CreateConainer extends React.Component {
9393 }
9494 }
9595
96- componentDidMount ( ) {
96+ componentDidMount ( ) {
9797 // sets route leave hook to show unsaved changes alert and persist incomplete project
9898 this . props . router . setRouteLeaveHook ( this . props . route , this . onLeave )
99+
99100 // sets window unload hook to show unsaved changes alert and persist incomplete project
100101 window . addEventListener ( 'beforeunload' , this . onLeave )
101102 }
@@ -105,15 +106,18 @@ class CreateConainer extends React.Component {
105106 }
106107
107108 // stores the incomplete project in local storage
108- onLeave ( e ) {
109- const { wizardStep, isProjectDirty, creatingProject } = this . state
109+ onLeave ( e ) { // eslint-disable-line no-unused-vars
110+ const { wizardStep, isProjectDirty } = this . state
110111 if ( wizardStep === ProjectWizard . Steps . WZ_STEP_FILL_PROJ_DETAILS && isProjectDirty ) { // Project Details step
111112 console . log ( 'saving incomplete project' )
112113 window . localStorage . setItem ( LS_INCOMPLETE_PROJECT , JSON . stringify ( this . state . updatedProject ) )
113114 }
114- if ( isProjectDirty && ! creatingProject ) {
115- return e . returnValue = 'You have unsaved changes. Are you sure you want to leave?'
116- }
115+ // commenting alerts for the page unload and route change hooks as discussed
116+ // https://github.com/appirio-tech/connect-app/issues/1037#issuecomment-324732052
117+
118+ // if (isProjectDirty && !creatingProject) {
119+ // return e.returnValue = 'You have unsaved changes. Are you sure you want to leave?'
120+ // }
117121 }
118122
119123 /**
You can’t perform that action at this time.
0 commit comments