Fix(nav): Protect against missing data
This commit is contained in:
@ -63,6 +63,10 @@ export function loadCurrentChallengeSaga(actions, getState) {
|
|||||||
challengeIdToName[ currentChallengeId ]
|
challengeIdToName[ currentChallengeId ]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
// challenge data may not be set yet.
|
||||||
|
if (!finalChallenge.id) {
|
||||||
|
return Observable.empty();
|
||||||
|
}
|
||||||
if (finalChallenge.id === currentlyLoadedChallengeId) {
|
if (finalChallenge.id === currentlyLoadedChallengeId) {
|
||||||
// don't reload if the challenge is already loaded.
|
// don't reload if the challenge is already loaded.
|
||||||
// This may change to toast to avoid user confusion
|
// This may change to toast to avoid user confusion
|
||||||
|
@ -22,6 +22,7 @@ export const firstChallengeSelector = createSelector(
|
|||||||
) {
|
) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
return challengeMap[
|
return challengeMap[
|
||||||
blockMap[
|
blockMap[
|
||||||
superBlockMap[
|
superBlockMap[
|
||||||
@ -29,5 +30,9 @@ export const firstChallengeSelector = createSelector(
|
|||||||
].blocks[0]
|
].blocks[0]
|
||||||
].challenges[0]
|
].challenges[0]
|
||||||
];
|
];
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err);
|
||||||
|
return {};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user