Fix(nav): Protect against missing data
This commit is contained in:
@ -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
|
||||
|
@ -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 {};
|
||||
}
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user