From 7b8da365f8ac665911aff4e36915272e671570c2 Mon Sep 17 00:00:00 2001 From: "Luiz R. Rodrigues" Date: Thu, 24 Sep 2020 08:18:22 -0300 Subject: [PATCH] Terms: Hotfix show details before redirect --- src/shared/containers/terms-detail/index.jsx | 25 +++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) 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 (
{ @@ -96,7 +105,7 @@ class TermsDetailPageContainer extends React.Component { ) : null } { - details + (details && details.text) ? (