fix(learn): reload when challenge tests change (#39832)

This commit is contained in:
Oliver Eyton-Williams
2020-11-02 18:22:01 +01:00
committed by GitHub
parent 5f67843e50
commit b0e3d7369b
2 changed files with 19 additions and 7 deletions

View File

@ -129,15 +129,21 @@ class ShowClassic extends Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { const {
data: { data: {
challengeNode: { title: prevTitle } challengeNode: {
title: prevTitle,
fields: { tests: prevTests }
}
} }
} = prevProps; } = prevProps;
const { const {
data: { data: {
challengeNode: { title: currentTitle } challengeNode: {
title: currentTitle,
fields: { tests: currTests }
}
} }
} = this.props; } = this.props;
if (prevTitle !== currentTitle) { if (prevTitle !== currentTitle || prevTests !== currTests) {
this.initializeComponent(currentTitle); this.initializeComponent(currentTitle);
} }
} }

View File

@ -100,16 +100,22 @@ export class BackEnd extends Component {
componentDidUpdate(prevProps) { componentDidUpdate(prevProps) {
const { const {
data: { data: {
challengeNode: { title: prevTitle } challengeNode: {
title: prevTitle,
fields: { tests: prevTests }
}
} }
} = prevProps; } = prevProps;
const { const {
data: { data: {
challengeNode: { title: currentTitle } challengeNode: {
title: currentTitle,
fields: { tests: currTests }
}
} }
} = this.props; } = this.props;
if (prevTitle !== currentTitle) { if (prevTitle !== currentTitle || prevTests !== currTests) {
this.initializeComponent(); this.initializeComponent(currentTitle);
} }
} }