Skip to content

Commit 7b8da36

Browse files
Terms: Hotfix show details before redirect
1 parent 6ed893f commit 7b8da36

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

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

+17-8
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,25 @@ class TermsDetailPageContainer extends React.Component {
3737
}
3838

3939
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+
4151
if (!_.isEqual(nextProps.termId, termId)) {
4252
loadTermDetails(authTokens, nextProps.termId);
4353
}
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+
}
4459
}
4560

4661
switchHandler() {
@@ -70,15 +85,9 @@ class TermsDetailPageContainer extends React.Component {
7085
agreeingTerm,
7186
agreeTermFailure,
7287
theme,
73-
history,
7488
} = this.props;
7589
const { termsAccepted, showModal } = this.state;
7690

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-
8291
return (
8392
<div className={theme['outer-container']}>
8493
{
@@ -96,7 +105,7 @@ class TermsDetailPageContainer extends React.Component {
96105
) : null
97106
}
98107
{
99-
details
108+
(details && details.text)
100109
? (
101110
<div className={theme['terms-detail-container']}>
102111
<MetaTags title={details.title} description={details.title} />

0 commit comments

Comments
 (0)