diff --git a/src/shared/containers/terms-detail/index.jsx b/src/shared/containers/terms-detail/index.jsx index 3bc8897294..af5efa5ab0 100644 --- a/src/shared/containers/terms-detail/index.jsx +++ b/src/shared/containers/terms-detail/index.jsx @@ -37,10 +37,25 @@ class TermsDetailPageContainer extends React.Component { } componentWillReceiveProps(nextProps) { - const { loadTermDetails, authTokens, termId } = this.props; + const { + loadTermDetails, + authTokens, + termId, + } = this.props; + + const { + details, + history, + } = nextProps; + if (!_.isEqual(nextProps.termId, termId)) { loadTermDetails(authTokens, nextProps.termId); } + + if (details && details.isLegacyTerm && !history.location.pathname.includes(details.id)) { + const path = `/challenges/terms/detail/${details.id}`; + history.push(path, history.state); + } } switchHandler() { @@ -70,15 +85,9 @@ class TermsDetailPageContainer extends React.Component { agreeingTerm, agreeTermFailure, theme, - history, } = this.props; const { termsAccepted, showModal } = this.state; - if (details && details.isLegacyTerm && !history.location.pathname.includes(details.id)) { - const path = `/challenges/terms/detail/${details.id}`; - history.push(path, history.state); - } - return (