@@ -166,7 +166,6 @@ class ChallengeDetailPageContainer extends React.Component {
166
166
reviewTypes,
167
167
getAllCountries,
168
168
getReviewTypes,
169
- history,
170
169
} = this . props ;
171
170
172
171
if (
@@ -192,7 +191,7 @@ class ChallengeDetailPageContainer extends React.Component {
192
191
&& ! challenge . fetchedWithAuth )
193
192
194
193
) {
195
- loadChallengeDetails ( auth , challengeId , history ) ;
194
+ loadChallengeDetails ( auth , challengeId ) ;
196
195
}
197
196
198
197
if ( ! allCountries . length ) {
@@ -219,8 +218,14 @@ class ChallengeDetailPageContainer extends React.Component {
219
218
auth,
220
219
challenge,
221
220
loadingRecommendedChallengesUUID,
221
+ history,
222
222
} = this . props ;
223
223
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
+
224
229
const recommendedTechnology = getRecommendedTags ( challenge ) ;
225
230
if (
226
231
challenge
@@ -843,15 +848,12 @@ const mapDispatchToProps = (dispatch) => {
843
848
dispatch ( lookupActions . getReviewTypesInit ( ) ) ;
844
849
dispatch ( lookupActions . getReviewTypesDone ( tokenV3 ) ) ;
845
850
} ,
846
- loadChallengeDetails : ( tokens , challengeId , history ) => {
851
+ loadChallengeDetails : ( tokens , challengeId ) => {
847
852
const a = actions . challenge ;
848
853
dispatch ( a . getDetailsInit ( challengeId ) ) ;
849
854
dispatch ( a . getDetailsDone ( challengeId , tokens . tokenV3 , tokens . tokenV2 ) )
850
855
. then ( ( res ) => {
851
856
const ch = res . payload ;
852
- if ( ch . isLegacyChallenge ) {
853
- history . location . pathname = `/challenges/${ ch . id } ` ; // eslint-disable-line no-param-reassign
854
- }
855
857
if ( ch . track === 'DESIGN' ) {
856
858
const p = ch . allPhases || ch . phases || [ ]
857
859
. filter ( x => x . name === 'Checkpoint Review' ) ;
0 commit comments