fix(client): handle builds without all challenges (#61040)

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2025-10-02 20:14:27 +05:30
committed by GitHub
co-authored by Shaun Hamilton
parent 568840b8d8
commit 517b9f0576
5 changed files with 95 additions and 32 deletions
+4 -8
View File
@@ -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',
-1
View File
@@ -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,