File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
Submission/Submit/Uploading Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1
- import React from "react" ;
1
+ import React , { useEffect , useRef } from "react" ;
2
2
import PT from "prop-types" ;
3
- import { Link } from "@reach/router" ;
3
+ import { Link , navigate } from "@reach/router" ;
4
4
import { PrimaryButton , DefaultButton as Button } from "components/Buttons" ;
5
5
import { COMPETITION_TRACKS , CHALLENGES_URL } from "../../../../constants" ;
6
6
import RobotHappy from "assets/icons/robot-happy.svg" ;
@@ -20,6 +20,20 @@ const Uploading = ({
20
20
uploadProgress,
21
21
back,
22
22
} ) => {
23
+ const propsRef = useRef ( ) ;
24
+ propsRef . current = { submitDone, challengeId } ;
25
+
26
+ useEffect ( ( ) => {
27
+ return ( ) => {
28
+ if ( propsRef . current . submitDone ) {
29
+ const backUrl = window . location . pathname ;
30
+ if ( backUrl === `${ CHALLENGES_URL } /${ challengeId } ` ) {
31
+ navigate ( `${ CHALLENGES_URL } /${ propsRef . current . challengeId } ?reload=true` ) ;
32
+ }
33
+ }
34
+ }
35
+ } , [ ] ) ;
36
+
23
37
return (
24
38
< div styleName = "container" >
25
39
< div styleName = "uploading" >
Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ class ChallengeDetailPageContainer extends React.Component {
221
221
challenge,
222
222
// loadingRecommendedChallengesUUID,
223
223
history,
224
+ loadChallengeDetails,
225
+ loadFullChallengeDetails,
226
+ isLoadingChallenge,
227
+ isLoadingTerms,
224
228
} = this . props ;
225
229
226
230
if (
@@ -247,6 +251,15 @@ class ChallengeDetailPageContainer extends React.Component {
247
251
// getAllRecommendedChallenges(auth.tokenV3, recommendedTechnology);
248
252
// }
249
253
254
+ const query = new URLSearchParams ( history . location . search ) ;
255
+ const isReloading = isLoadingChallenge || isLoadingTerms ;
256
+ if ( query . get ( 'reload' ) && ! isReloading ) {
257
+ history . replace ( history . location . pathname , history . state ) ;
258
+ loadChallengeDetails ( nextProps . auth , challengeId , loadFullChallengeDetails ) ;
259
+
260
+ return ;
261
+ }
262
+
250
263
const { thriveArticles } = this . state ;
251
264
const userId = _ . get ( this , "props.auth.user.userId" ) ;
252
265
const nextUserId = _ . get ( nextProps , "auth.user.userId" ) ;
You can’t perform that action at this time.
0 commit comments