File tree 1 file changed +17
-8
lines changed
src/shared/containers/terms-detail
1 file changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,25 @@ class TermsDetailPageContainer extends React.Component {
37
37
}
38
38
39
39
componentWillReceiveProps ( nextProps ) {
40
- const { loadTermDetails, authTokens, termId } = this . props ;
40
+ const {
41
+ loadTermDetails,
42
+ authTokens,
43
+ termId,
44
+ } = this . props ;
45
+
46
+ const {
47
+ details,
48
+ history,
49
+ } = nextProps ;
50
+
41
51
if ( ! _ . isEqual ( nextProps . termId , termId ) ) {
42
52
loadTermDetails ( authTokens , nextProps . termId ) ;
43
53
}
54
+
55
+ if ( details && details . isLegacyTerm && ! history . location . pathname . includes ( details . id ) ) {
56
+ const path = `/challenges/terms/detail/${ details . id } ` ;
57
+ history . push ( path , history . state ) ;
58
+ }
44
59
}
45
60
46
61
switchHandler ( ) {
@@ -70,15 +85,9 @@ class TermsDetailPageContainer extends React.Component {
70
85
agreeingTerm,
71
86
agreeTermFailure,
72
87
theme,
73
- history,
74
88
} = this . props ;
75
89
const { termsAccepted, showModal } = this . state ;
76
90
77
- if ( details && details . isLegacyTerm && ! history . location . pathname . includes ( details . id ) ) {
78
- const path = `/challenges/terms/detail/${ details . id } ` ;
79
- history . push ( path , history . state ) ;
80
- }
81
-
82
91
return (
83
92
< div className = { theme [ 'outer-container' ] } >
84
93
{
@@ -96,7 +105,7 @@ class TermsDetailPageContainer extends React.Component {
96
105
) : null
97
106
}
98
107
{
99
- details
108
+ ( details && details . text )
100
109
? (
101
110
< div className = { theme [ 'terms-detail-container' ] } >
102
111
< MetaTags title = { details . title } description = { details . title } />
You can’t perform that action at this time.
0 commit comments