mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-06-22 21:08:12 +08:00
fix(client): site crashing when leaving rdb challenge (#49409)
fix: crashing when leaving rdb
This commit is contained in:
parent
ac08298c7b
commit
c29ecaf14f
@ -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`} />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user