fix(client): site crashing when leaving rdb challenge (#49409)

fix: crashing when leaving rdb
This commit is contained in:
Tom
2023-02-17 07:56:28 +02:00
committed by GitHub
parent ac08298c7b
commit c29ecaf14f
2 changed files with 7 additions and 4 deletions
+7 -1
View File
@@ -25,6 +25,7 @@ import {
userSelector,
isOnlineSelector,
isServerOnlineSelector,
showCodeAllySelector,
userFetchStateSelector
} from '../../redux/selectors';
@@ -56,6 +57,7 @@ const mapStateToProps = createSelector(
isOnlineSelector,
isServerOnlineSelector,
userFetchStateSelector,
showCodeAllySelector,
userSelector,
(
isSignedIn,
@@ -63,6 +65,7 @@ const mapStateToProps = createSelector(
isOnline: boolean,
isServerOnline: boolean,
fetchState: UserFetchState,
showCodeAlly: boolean,
user: User
) => ({
isSignedIn,
@@ -72,6 +75,7 @@ const mapStateToProps = createSelector(
isServerOnline,
fetchState,
theme: user.theme,
showCodeAlly,
user
})
);
@@ -98,6 +102,7 @@ interface DefaultLayoutProps extends StateProps, DispatchProps {
showFooter?: boolean;
isChallenge?: boolean;
block?: string;
showCodeAlly: boolean;
superBlock?: string;
t: TFunction;
}
@@ -124,6 +129,7 @@ function DefaultLayout({
superBlock,
t,
theme = Themes.Default,
showCodeAlly,
user,
fetchUser,
updateAllChallengesInfo
@@ -230,7 +236,7 @@ function DefaultLayout({
/>
) : null}
<SignoutModal />
{isChallenge && (
{isChallenge && !showCodeAlly && (
<div className='breadcrumbs-demo'>
<BreadCrumb
block={block as string}
@@ -230,9 +230,6 @@ class ShowCodeAlly extends Component<ShowCodeAllyProps> {
challenge => challenge.id === challengeId
);
const breadcrumbs = document.querySelector('.breadcrumbs-demo');
showCodeAlly && breadcrumbs?.remove();
return showCodeAlly ? (
<LearnLayout>
<Helmet title={`${blockName}: ${title} | freeCodeCamp.org`} />