@@ -36,8 +36,12 @@ const ScratchDesktopHOC = function (WrappedComponent) {
36
36
'handleSetTitleFromSave' ,
37
37
'handleStorageInit' ,
38
38
'handleTelemetryModalOptIn' ,
39
- 'handleTelemetryModalOptOut'
39
+ 'handleTelemetryModalOptOut' ,
40
+ 'handleUpdateProjectTitle'
40
41
] ) ;
42
+ this . state = {
43
+ projectTitle : null
44
+ } ;
41
45
}
42
46
componentDidMount ( ) {
43
47
ipcRenderer . on ( 'setTitleFromSave' , this . handleSetTitleFromSave ) ;
@@ -52,7 +56,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
52
56
ipcRenderer . send ( event , metadata ) ;
53
57
}
54
58
handleSetTitleFromSave ( event , args ) {
55
- this . props . onUpdateProjectTitle ( args . title ) ;
59
+ this . handleUpdateProjectTitle ( args . title ) ;
56
60
}
57
61
handleStorageInit ( storageInstance ) {
58
62
storageInstance . addHelper ( new ElectronStorageHelper ( storageInstance ) ) ;
@@ -63,6 +67,9 @@ const ScratchDesktopHOC = function (WrappedComponent) {
63
67
handleTelemetryModalOptOut ( ) {
64
68
ipcRenderer . send ( 'setTelemetryDidOptIn' , false ) ;
65
69
}
70
+ handleUpdateProjectTitle ( newTitle ) {
71
+ this . setState ( { projectTitle : newTitle } ) ;
72
+ }
66
73
render ( ) {
67
74
const shouldShowTelemetryModal = ( typeof ipcRenderer . sendSync ( 'getTelemetryDidOptIn' ) !== 'boolean' ) ;
68
75
return ( < WrappedComponent
@@ -74,15 +81,12 @@ const ScratchDesktopHOC = function (WrappedComponent) {
74
81
onStorageInit = { this . handleStorageInit }
75
82
onTelemetryModalOptIn = { this . handleTelemetryModalOptIn }
76
83
onTelemetryModalOptOut = { this . handleTelemetryModalOptOut }
84
+ onUpdateProjectTitle = { this . handleUpdateProjectTitle }
77
85
{ ...this . props }
78
86
/> ) ;
79
87
}
80
88
}
81
89
82
- ScratchDesktopComponent . propTypes = {
83
- onUpdateProjectTitle : PropTypes . func
84
- } ;
85
-
86
90
return ScratchDesktopComponent ;
87
91
} ;
88
92
@@ -91,8 +95,7 @@ const ScratchDesktopHOC = function (WrappedComponent) {
91
95
// ability to compose reducers.
92
96
const WrappedGui = compose (
93
97
AppStateHOC ,
94
- TitledHOC ,
95
- ScratchDesktopHOC // must come after `TitledHOC` so it has access to `onUpdateProjectTitle`
98
+ ScratchDesktopHOC
96
99
) ( GUI ) ;
97
100
98
101
ReactDOM . render ( < WrappedGui /> , appTarget ) ;
0 commit comments