Skip to content

Commit debbf90

Browse files
authored
Merge pull request #4465 from simranb86/issue_4435
fix for issue #4435
2 parents 001d049 + 189c040 commit debbf90

File tree

1 file changed

+8
-6
lines changed
  • src/shared/containers/challenge-detail

1 file changed

+8
-6
lines changed

src/shared/containers/challenge-detail/index.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ class ChallengeDetailPageContainer extends React.Component {
166166
reviewTypes,
167167
getAllCountries,
168168
getReviewTypes,
169-
history,
170169
} = this.props;
171170

172171
if (
@@ -192,7 +191,7 @@ class ChallengeDetailPageContainer extends React.Component {
192191
&& !challenge.fetchedWithAuth)
193192

194193
) {
195-
loadChallengeDetails(auth, challengeId, history);
194+
loadChallengeDetails(auth, challengeId);
196195
}
197196

198197
if (!allCountries.length) {
@@ -219,8 +218,14 @@ class ChallengeDetailPageContainer extends React.Component {
219218
auth,
220219
challenge,
221220
loadingRecommendedChallengesUUID,
221+
history,
222222
} = this.props;
223223

224+
if (challenge.isLegacyChallenge && !history.location.pathname.includes(challenge.id)) {
225+
history.location.pathname = `/challenges/${challenge.id}`; // eslint-disable-line no-param-reassign
226+
history.push(history.location.pathname, history.state);
227+
}
228+
224229
const recommendedTechnology = getRecommendedTags(challenge);
225230
if (
226231
challenge
@@ -843,15 +848,12 @@ const mapDispatchToProps = (dispatch) => {
843848
dispatch(lookupActions.getReviewTypesInit());
844849
dispatch(lookupActions.getReviewTypesDone(tokenV3));
845850
},
846-
loadChallengeDetails: (tokens, challengeId, history) => {
851+
loadChallengeDetails: (tokens, challengeId) => {
847852
const a = actions.challenge;
848853
dispatch(a.getDetailsInit(challengeId));
849854
dispatch(a.getDetailsDone(challengeId, tokens.tokenV3, tokens.tokenV2))
850855
.then((res) => {
851856
const ch = res.payload;
852-
if (ch.isLegacyChallenge) {
853-
history.location.pathname = `/challenges/${ch.id}`; // eslint-disable-line no-param-reassign
854-
}
855857
if (ch.track === 'DESIGN') {
856858
const p = ch.allPhases || ch.phases || []
857859
.filter(x => x.name === 'Checkpoint Review');

0 commit comments

Comments
 (0)