Skip to content

Commit 58ef9be

Browse files
committed
fix 2nd load of project details
1 parent 46f6345 commit 58ef9be

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/containers/ChallengeEditor/index.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class ChallengeEditor extends Component {
6161
this.closeSuccessModal = this.closeSuccessModal.bind(this)
6262
this.onCloseTask = this.onCloseTask.bind(this)
6363
this.closeTask = this.closeTask.bind(this)
64+
this.fetchProjectDetails = this.fetchProjectDetails.bind(this)
6465
}
6566

6667
componentDidMount () {
@@ -76,9 +77,7 @@ class ChallengeEditor extends Component {
7677
loadGroups,
7778
loadResourceRoles,
7879
loadChallengeDetails,
79-
loadResources,
80-
loadProject,
81-
projectDetail
80+
loadResources
8281
} = this.props
8382
loadTimelineTemplates()
8483
loadChallengePhases()
@@ -89,11 +88,7 @@ class ChallengeEditor extends Component {
8988
// loadChallengeTerms()
9089
loadGroups()
9190
loadResourceRoles()
92-
if (!projectDetail.terms) {
93-
this.fetchProjectDetails(match, loadProject)
94-
}
9591
this.fetchChallengeDetails(match, loadChallengeDetails, loadResources)
96-
9792
// this.unlisten = this.props.history.listen(() => {
9893
// const { isLoading } = this.props
9994
// if (!isLoading) {
@@ -119,11 +114,11 @@ class ChallengeEditor extends Component {
119114
}
120115
}
121116

122-
async fetchProjectDetails (newMatch, loadProject) {
117+
async fetchProjectDetails (newMatch) {
123118
let projectId = _.get(newMatch.params, 'projectId', null)
124119
projectId = projectId ? parseInt(projectId) : null
125120
if (projectId) {
126-
await loadProject(projectId)
121+
await this.props.loadProject(projectId)
127122
}
128123
}
129124

@@ -133,6 +128,9 @@ class ChallengeEditor extends Component {
133128
const challengeId = _.get(newMatch.params, 'challengeId', null)
134129
await loadResources(challengeId)
135130
loadChallengeDetails(projectId, challengeId)
131+
if (!challengeId) {
132+
this.fetchProjectDetails(newMatch)
133+
}
136134
}
137135

138136
isEditable () {

0 commit comments

Comments
 (0)