@@ -3,7 +3,10 @@ import React from 'react';
3
3
import { connect } from 'react-redux' ;
4
4
import { defineMessages , injectIntl , intlShape } from 'react-intl' ;
5
5
6
- import { getIsShowingWithoutId } from '../reducers/project-state' ;
6
+ import {
7
+ getIsAnyCreatingNewState ,
8
+ getIsShowingWithoutId
9
+ } from '../reducers/project-state' ;
7
10
import { setProjectTitle } from '../reducers/project-title' ;
8
11
9
12
const messages = defineMessages ( {
@@ -27,7 +30,7 @@ const TitledHOC = function (WrappedComponent) {
27
30
if ( this . props . projectTitle !== prevProps . projectTitle ) {
28
31
this . handleReceivedProjectTitle ( this . props . projectTitle ) ;
29
32
}
30
- if ( this . props . isShowingWithoutId && ! prevProps . isShowingWithoutId ) {
33
+ if ( this . props . isShowingWithoutId && prevProps . isAnyCreatingNewState ) {
31
34
const defaultProjectTitle = this . handleReceivedProjectTitle ( ) ;
32
35
this . props . onUpdateProjectTitle ( defaultProjectTitle ) ;
33
36
}
@@ -50,6 +53,7 @@ const TitledHOC = function (WrappedComponent) {
50
53
const {
51
54
/* eslint-disable no-unused-vars */
52
55
intl,
56
+ isAnyCreatingNewState,
53
57
isShowingWithoutId,
54
58
onChangedProjectTitle,
55
59
// for children, we replace onUpdateProjectTitle with our own
@@ -71,6 +75,7 @@ const TitledHOC = function (WrappedComponent) {
71
75
72
76
TitledComponent . propTypes = {
73
77
intl : intlShape ,
78
+ isAnyCreatingNewState : PropTypes . bool ,
74
79
isShowingWithoutId : PropTypes . bool ,
75
80
onChangedProjectTitle : PropTypes . func ,
76
81
onUpdateProjectTitle : PropTypes . func ,
@@ -85,6 +90,7 @@ const TitledHOC = function (WrappedComponent) {
85
90
const mapStateToProps = state => {
86
91
const loadingState = state . scratchGui . projectState . loadingState ;
87
92
return {
93
+ isAnyCreatingNewState : getIsAnyCreatingNewState ( loadingState ) ,
88
94
isShowingWithoutId : getIsShowingWithoutId ( loadingState ) ,
89
95
reduxProjectTitle : state . scratchGui . projectTitle
90
96
} ;
0 commit comments