@@ -74,7 +74,7 @@ const vmListenerHOC = function (WrappedComponent) {
7474 }
7575 }
7676 handleProjectChanged ( ) {
77- if ( this . props . shouldEmitUpdates ) {
77+ if ( this . props . shouldEmitUpdates && ! this . props . projectChanged ) {
7878 this . props . onProjectChanged ( ) ;
7979 }
8080 }
@@ -117,6 +117,7 @@ const vmListenerHOC = function (WrappedComponent) {
117117 const {
118118 /* eslint-disable no-unused-vars */
119119 attachKeyboardEvents,
120+ projectChanged,
120121 shouldEmitUpdates,
121122 onBlockDragUpdate,
122123 onGreenFlag,
@@ -154,6 +155,7 @@ const vmListenerHOC = function (WrappedComponent) {
154155 onTargetsUpdate : PropTypes . func . isRequired ,
155156 onTurboModeOff : PropTypes . func . isRequired ,
156157 onTurboModeOn : PropTypes . func . isRequired ,
158+ projectChanged : PropTypes . bool ,
157159 shouldEmitUpdates : PropTypes . bool ,
158160 username : PropTypes . string ,
159161 vm : PropTypes . instanceOf ( VM ) . isRequired
@@ -163,6 +165,7 @@ const vmListenerHOC = function (WrappedComponent) {
163165 onGreenFlag : ( ) => ( { } )
164166 } ;
165167 const mapStateToProps = state => ( {
168+ projectChanged : state . scratchGui . projectChanged ,
166169 // Do not emit target or project updates in fullscreen or player only mode
167170 // or when recording sounds (it leads to garbled recordings on low-power machines)
168171 shouldEmitUpdates : ! state . scratchGui . mode . isFullScreen && ! state . scratchGui . mode . isPlayerOnly &&
0 commit comments