@@ -97,6 +97,7 @@ class SBFileUploader extends React.Component {
9797 onload ( ) {
9898 if ( this . reader ) {
9999 this . props . onLoadingStarted ( ) ;
100+ const filename = this . fileToUpload && this . fileToUpload . name ;
100101 this . props . vm . loadProject ( this . reader . result )
101102 . then ( ( ) => {
102103 analytics . event ( {
@@ -109,10 +110,11 @@ class SBFileUploader extends React.Component {
109110 this . props . onLoadingFinished ( this . props . loadingState , true ) ;
110111 // Reset the file input after project is loaded
111112 // This is necessary in case the user wants to reload a project
113+ if ( filename ) {
114+ const uploadedProjectTitle = this . getProjectTitleFromFilename ( filename ) ;
115+ this . props . onUpdateProjectTitle ( uploadedProjectTitle ) ;
116+ }
112117 this . resetFileInput ( ) ;
113- // disable title handling for now; @todo reenable, with correct logic
114- // const uploadedProjectTitle = this.getProjectTitleFromFilename(thisFileInput.files[0].name);
115- // this.props.onUpdateProjectTitle(uploadedProjectTitle);
116118 } )
117119 . catch ( error => {
118120 log . warn ( error ) ;
@@ -156,7 +158,7 @@ SBFileUploader.propTypes = {
156158 loadingState : PropTypes . oneOf ( LoadingStates ) ,
157159 onLoadingFinished : PropTypes . func ,
158160 onLoadingStarted : PropTypes . func ,
159- // onUpdateProjectTitle: PropTypes.func,
161+ onUpdateProjectTitle : PropTypes . func ,
160162 requestProjectUpload : PropTypes . func ,
161163 vm : PropTypes . shape ( {
162164 loadProject : PropTypes . func
0 commit comments