@@ -127,10 +127,7 @@ class CreateContainer extends React.Component {
127127 const incompleteProjectStr = window . localStorage . getItem ( LS_INCOMPLETE_PROJECT )
128128 if ( incompleteProjectStr ) {
129129 const incompleteProject = JSON . parse ( incompleteProjectStr )
130- const incompleteProjectTemplateKey = _ . get ( incompleteProject , 'details.products[0]' )
131130 if ( match . path === '/new-project-callback' && ! processing && userRoles && userRoles . length > 0 ) {
132- const projectTemplate = getProjectTemplateByKey ( templates . projectTemplates , incompleteProjectTemplateKey )
133- this . prepareProjectForCreation ( incompleteProject , projectTemplate )
134131 // if project wizard is loaded after redirection from register page
135132 // TODO should we validate the project again?
136133 console . log ( 'calling createProjectAction...' )
@@ -168,7 +165,13 @@ class CreateContainer extends React.Component {
168165 // stores the incomplete project in local storage
169166 onLeave ( e ) { // eslint-disable-line no-unused-vars
170167 const { wizardStep, isProjectDirty } = this . state
168+ const { templates : { projectTemplates } } = this . props
169+
171170 if ( wizardStep === ProjectWizard . Steps . WZ_STEP_FILL_PROJ_DETAILS && isProjectDirty ) { // Project Details step
171+
172+ const projectTemplateKey = _ . get ( this . state . updatedProject , 'details.products[0]' )
173+ const projectTemplate = getProjectTemplateByKey ( projectTemplates , projectTemplateKey )
174+ this . prepareProjectForCreation ( this . state . updatedProject , projectTemplate )
172175 console . log ( 'saving incomplete project' , this . state . updatedProject )
173176 window . localStorage . setItem ( LS_INCOMPLETE_PROJECT , JSON . stringify ( this . state . updatedProject ) )
174177 }
0 commit comments