@@ -36,8 +36,12 @@ const ScratchDesktopHOC = function (WrappedComponent) {
3636 'handleSetTitleFromSave' ,
3737 'handleStorageInit' ,
3838 'handleTelemetryModalOptIn' ,
39- 'handleTelemetryModalOptOut'
39+ 'handleTelemetryModalOptOut' ,
40+ 'handleUpdateProjectTitle'
4041 ] ) ;
42+ this . state = {
43+ projectTitle : null
44+ } ;
4145 }
4246 componentDidMount ( ) {
4347 ipcRenderer . on ( 'setTitleFromSave' , this . handleSetTitleFromSave ) ;
@@ -52,7 +56,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
5256 ipcRenderer . send ( event , metadata ) ;
5357 }
5458 handleSetTitleFromSave ( event , args ) {
55- this . props . onUpdateProjectTitle ( args . title ) ;
59+ this . handleUpdateProjectTitle ( args . title ) ;
5660 }
5761 handleStorageInit ( storageInstance ) {
5862 storageInstance . addHelper ( new ElectronStorageHelper ( storageInstance ) ) ;
@@ -63,6 +67,9 @@ const ScratchDesktopHOC = function (WrappedComponent) {
6367 handleTelemetryModalOptOut ( ) {
6468 ipcRenderer . send ( 'setTelemetryDidOptIn' , false ) ;
6569 }
70+ handleUpdateProjectTitle ( newTitle ) {
71+ this . setState ( { projectTitle : newTitle } ) ;
72+ }
6673 render ( ) {
6774 const shouldShowTelemetryModal = ( typeof ipcRenderer . sendSync ( 'getTelemetryDidOptIn' ) !== 'boolean' ) ;
6875 return ( < WrappedComponent
@@ -74,15 +81,12 @@ const ScratchDesktopHOC = function (WrappedComponent) {
7481 onStorageInit = { this . handleStorageInit }
7582 onTelemetryModalOptIn = { this . handleTelemetryModalOptIn }
7683 onTelemetryModalOptOut = { this . handleTelemetryModalOptOut }
84+ onUpdateProjectTitle = { this . handleUpdateProjectTitle }
7785 { ...this . props }
7886 /> ) ;
7987 }
8088 }
8189
82- ScratchDesktopComponent . propTypes = {
83- onUpdateProjectTitle : PropTypes . func
84- } ;
85-
8690 return ScratchDesktopComponent ;
8791} ;
8892
@@ -91,8 +95,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
9195// ability to compose reducers.
9296const WrappedGui = compose (
9397 AppStateHOC ,
94- TitledHOC ,
95- ScratchDesktopHOC // must come after `TitledHOC` so it has access to `onUpdateProjectTitle`
98+ ScratchDesktopHOC
9699) ( GUI ) ;
97100
98101ReactDOM . render ( < WrappedGui /> , appTarget ) ;
0 commit comments