diff --git a/common/app/redux/load-current-challenge-saga.js b/common/app/redux/load-current-challenge-saga.js index 00e1a3a7dc..d90cf8e853 100644 --- a/common/app/redux/load-current-challenge-saga.js +++ b/common/app/redux/load-current-challenge-saga.js @@ -63,6 +63,10 @@ export function loadCurrentChallengeSaga(actions, getState) { challengeIdToName[ currentChallengeId ] ]; } + // challenge data may not be set yet. + if (!finalChallenge.id) { + return Observable.empty(); + } if (finalChallenge.id === currentlyLoadedChallengeId) { // don't reload if the challenge is already loaded. // This may change to toast to avoid user confusion diff --git a/common/app/redux/selectors.js b/common/app/redux/selectors.js index 915b0929db..0a56f23a23 100644 --- a/common/app/redux/selectors.js +++ b/common/app/redux/selectors.js @@ -22,12 +22,17 @@ export const firstChallengeSelector = createSelector( ) { return {}; } - return challengeMap[ - blockMap[ - superBlockMap[ - superBlocks[0] - ].blocks[0] - ].challenges[0] - ]; + try { + return challengeMap[ + blockMap[ + superBlockMap[ + superBlocks[0] + ].blocks[0] + ].challenges[0] + ]; + } catch (err) { + console.error(err); + return {}; + } } );