Skip to content

Commit 56cd3d2

Browse files
author
Vikas Agarwal
committed
fix: git#839, Loading edit URL for a challenge directly does not load copilot information
— waiting for resources to load before fetching challenge details to make sure we always have resources ready for the challenge. Better is to refactor the logic to actions and make a multi promise call to make sure all data is available when challenge details are loaded
1 parent b952a0f commit 56cd3d2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/actions/challenges.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ export function loadResources (challengeId) {
427427
})
428428

429429
if (challengeId) {
430-
fetchResources(challengeId).then((resources) => {
430+
return fetchResources(challengeId).then((resources) => {
431431
dispatch({
432432
type: LOAD_CHALLENGE_RESOURCES_SUCCESS,
433433
challengeResources: resources

src/containers/ChallengeEditor/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ class ChallengeEditor extends Component {
105105
}
106106
}
107107

108-
fetchChallengeDetails (newMatch, loadChallengeDetails, loadResources) {
108+
async fetchChallengeDetails (newMatch, loadChallengeDetails, loadResources) {
109109
const projectId = _.get(newMatch.params, 'projectId', null)
110110
const challengeId = _.get(newMatch.params, 'challengeId', null)
111-
loadResources(challengeId)
111+
await loadResources(challengeId)
112112
loadChallengeDetails(projectId, challengeId)
113113
}
114114

0 commit comments

Comments
 (0)