At the top of my component's render I have a series of conditional Router <Redirect>
s. It's not an If-Else, but the understanding is that if it satisfies the condition, it will redirect.
However, I'm finding that these <Redirect>
s somehow fall through. If the 3rd condition is satisfied it will be the last to perform its redirect, even if the 1st one was satisfied also. The debugger doesn't stop when the 1st condition is satisfied and continues rendering the component.
{/* If form is submitted in the Submit mode with the ChangeApprover scenario, redirect to /agreements with the Submit ChangeApprover success message */}
{ (isFormSubmitted && submitValidationMode && isChangeApprover)
&&
<Redirect to={"/agreements?result=submitChangeApprover&approver=" + encodeURIComponent(detailedApproverUserInfo ? detailedApproverUserInfo.firstName_lastName_regular : "N/A")} />
}
{/* If form is submitted in the Submit mode from the Renew mode, redirect to /agreements with the Renew success message */}
{ (isFormSubmitted && submitValidationMode && props.mode === 'renew')
&&
<Redirect to={"/agreements?result=renew&approver=" + encodeURIComponent(detailedApproverUserInfo ? detailedApproverUserInfo.firstName_lastName_regular : "N/A")} />
}
{/* If form is submitted in the Submit mode from a non-Renew mode, redirect to /agreements with the Submit success message */}
{ (isFormSubmitted && submitValidationMode && props.mode !== 'renew')
&&
<Redirect to={"/agreements?result=submit&approver=" + encodeURIComponent(detailedApproverUserInfo ? detailedApproverUserInfo.firstName_lastName_regular : "N/A")} />
}