@@ -113,30 +113,18 @@ class ChallengeEditor extends Component {
113
113
this . getTemplatePhases = this . getTemplatePhases . bind ( this )
114
114
this . getAvailableTimelineTemplates = this . getAvailableTimelineTemplates . bind ( this )
115
115
this . autoUpdateChallengeThrottled = _ . throttle ( this . autoUpdateChallenge . bind ( this ) , 3000 ) // 3s
116
- this . resetChallengeData ( ( newState , finish ) => {
117
- this . state = {
118
- ...this . state ,
119
- ...newState
120
- }
121
- if ( finish ) {
122
- finish ( )
123
- }
124
- } )
125
116
}
126
117
127
- componentDidUpdate ( ) {
118
+ componentDidMount ( ) {
128
119
this . resetChallengeData ( this . setState . bind ( this ) )
129
120
}
130
121
131
- componentWillReceiveProps ( nextProps ) {
132
- // if member details weren't initially loaded and now they got loaded, then set them to the state
133
- if ( ! this . state . assignedMemberDetails && nextProps . assignedMemberDetails ) {
134
- this . setState ( { assignedMemberDetails : nextProps . assignedMemberDetails } )
135
- }
122
+ componentDidUpdate ( ) {
123
+ this . resetChallengeData ( this . setState . bind ( this ) )
136
124
}
137
125
138
126
async resetChallengeData ( setState = ( ) => { } ) {
139
- const { isNew, challengeDetails, metadata, attachments, challengeId } = this . props
127
+ const { isNew, challengeDetails, metadata, attachments, challengeId, assignedMemberDetails } = this . props
140
128
if (
141
129
challengeDetails &&
142
130
challengeDetails . id &&
@@ -160,10 +148,11 @@ class ChallengeEditor extends Component {
160
148
}
161
149
challengeData . copilot = copilot || copilotFromResources
162
150
challengeData . reviewer = reviewer || reviewerFromResources
163
- const challengeDetail = { ...dropdowns [ 'newChallenge' ] , ... challengeData }
151
+ const challengeDetail = { ...challengeData }
164
152
const isOpenAdvanceSettings = challengeDetail . groups . length > 0
165
153
setState ( {
166
154
challenge : challengeDetail ,
155
+ assignedMemberDetails,
167
156
draftChallenge : { data : {
168
157
..._ . cloneDeep ( challengeDetails ) ,
169
158
copilot : challengeData . copilot ,
0 commit comments