mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-10-24 23:49:06 +08:00
fix(client): handle builds without all challenges (#61040)
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
co-authored by
Shaun Hamilton
parent
568840b8d8
commit
517b9f0576
@@ -57,7 +57,7 @@ interface LearnPageProps {
|
||||
challenge: {
|
||||
fields: Slug;
|
||||
};
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -67,18 +67,14 @@ function LearnPage({
|
||||
isSignedIn,
|
||||
fetchState: { pending, complete },
|
||||
user,
|
||||
data: {
|
||||
challengeNode: {
|
||||
challenge: {
|
||||
fields: { slug }
|
||||
}
|
||||
}
|
||||
}
|
||||
data: { challengeNode }
|
||||
}: LearnPageProps) {
|
||||
const { name, completedChallengeCount, isDonating } = user ?? EMPTY_USER;
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const slug = challengeNode?.challenge?.fields?.slug || '';
|
||||
|
||||
const onLearnDonationAlertClick = () => {
|
||||
callGA({
|
||||
event: 'donation_related',
|
||||
|
||||
@@ -188,7 +188,6 @@ export type ChallengeNode = {
|
||||
fields: Fields;
|
||||
fillInTheBlank: FillInTheBlank;
|
||||
forumTopicId: number;
|
||||
guideUrl: string;
|
||||
head: string[];
|
||||
hasEditableBoundaries: boolean;
|
||||
helpCategory: string;
|
||||
|
||||
@@ -20,7 +20,7 @@ interface SuperBlockIntroQueryData {
|
||||
slug: string;
|
||||
};
|
||||
};
|
||||
};
|
||||
} | null;
|
||||
}
|
||||
|
||||
type ReduxProps = ConnectedProps<typeof connector>;
|
||||
@@ -115,13 +115,7 @@ function SuperBlockIntro({
|
||||
note: string;
|
||||
};
|
||||
|
||||
const {
|
||||
challengeNode: {
|
||||
challenge: {
|
||||
fields: { slug: firstChallengeSlug }
|
||||
}
|
||||
}
|
||||
} = useStaticQuery<SuperBlockIntroQueryData>(graphql`
|
||||
const { challengeNode } = useStaticQuery<SuperBlockIntroQueryData>(graphql`
|
||||
query SuperBlockIntroQuery {
|
||||
challengeNode(
|
||||
challenge: {
|
||||
@@ -139,6 +133,7 @@ function SuperBlockIntro({
|
||||
}
|
||||
`);
|
||||
|
||||
const firstChallengeSlug = challengeNode?.challenge?.fields?.slug || '';
|
||||
const {
|
||||
title: i18nSuperBlock,
|
||||
intro: superBlockIntroText,
|
||||
|
||||
Reference in New Issue
Block a user