@@ -61,6 +61,7 @@ class ChallengeEditor extends Component {
61
61
this . closeSuccessModal = this . closeSuccessModal . bind ( this )
62
62
this . onCloseTask = this . onCloseTask . bind ( this )
63
63
this . closeTask = this . closeTask . bind ( this )
64
+ this . fetchProjectDetails = this . fetchProjectDetails . bind ( this )
64
65
}
65
66
66
67
componentDidMount ( ) {
@@ -76,9 +77,7 @@ class ChallengeEditor extends Component {
76
77
loadGroups,
77
78
loadResourceRoles,
78
79
loadChallengeDetails,
79
- loadResources,
80
- loadProject,
81
- projectDetail
80
+ loadResources
82
81
} = this . props
83
82
loadTimelineTemplates ( )
84
83
loadChallengePhases ( )
@@ -89,11 +88,7 @@ class ChallengeEditor extends Component {
89
88
// loadChallengeTerms()
90
89
loadGroups ( )
91
90
loadResourceRoles ( )
92
- if ( ! projectDetail . terms ) {
93
- this . fetchProjectDetails ( match , loadProject )
94
- }
95
91
this . fetchChallengeDetails ( match , loadChallengeDetails , loadResources )
96
-
97
92
// this.unlisten = this.props.history.listen(() => {
98
93
// const { isLoading } = this.props
99
94
// if (!isLoading) {
@@ -119,11 +114,11 @@ class ChallengeEditor extends Component {
119
114
}
120
115
}
121
116
122
- async fetchProjectDetails ( newMatch , loadProject ) {
117
+ async fetchProjectDetails ( newMatch ) {
123
118
let projectId = _ . get ( newMatch . params , 'projectId' , null )
124
119
projectId = projectId ? parseInt ( projectId ) : null
125
120
if ( projectId ) {
126
- await loadProject ( projectId )
121
+ await this . props . loadProject ( projectId )
127
122
}
128
123
}
129
124
@@ -133,6 +128,9 @@ class ChallengeEditor extends Component {
133
128
const challengeId = _ . get ( newMatch . params , 'challengeId' , null )
134
129
await loadResources ( challengeId )
135
130
loadChallengeDetails ( projectId , challengeId )
131
+ if ( ! challengeId ) {
132
+ this . fetchProjectDetails ( newMatch )
133
+ }
136
134
}
137
135
138
136
isEditable ( ) {
0 commit comments