Skip to content

fix: #5781 #5824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/shared/components/Settings/Profile/BasicInfo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export default class BasicInfo extends ConsentComponent {

const { userTraits } = props;
this.state = {
componentMounted: false,
inputChanged: false,
formInvalid: false,
basicInfoTrait: this.loadBasicInfoTraits(userTraits),
Expand Down Expand Up @@ -81,6 +82,9 @@ export default class BasicInfo extends ConsentComponent {
const { basicInfoTrait } = this.state;
const basicInfo = basicInfoTrait.traits ? basicInfoTrait.traits.data[0] : {};
this.processBasicInfo(basicInfo);
this.setState({
componentMounted: true,
});
}

componentWillReceiveProps(nextProps) {
Expand Down Expand Up @@ -457,6 +461,7 @@ export default class BasicInfo extends ConsentComponent {
const {
newBasicInfo,
inputChanged,
componentMounted,
} = this.state;

const canModifyTrait = !this.props.traitRequestCount;
Expand Down Expand Up @@ -497,7 +502,7 @@ export default class BasicInfo extends ConsentComponent {
<div styleName="field col-2">
<span styleName="text-required">* Required</span>
<input disabled={!canModifyTrait} id="firstName" name="firstName" type="text" placeholder="First Name" onChange={this.onUpdateInput} value={newBasicInfo.firstName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && inputChanged} message="First Name cannot be empty" />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.firstName) && componentMounted} message="First Name cannot be empty" />
</div>
</div>
<div styleName="row">
Expand All @@ -510,7 +515,7 @@ export default class BasicInfo extends ConsentComponent {
<div styleName="field col-2">
<span styleName="text-required">* Required</span>
<input disabled={!canModifyTrait} id="lastName" name="lastName" type="text" placeholder="Last Name" onChange={this.onUpdateInput} value={newBasicInfo.lastName} maxLength="64" required />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && inputChanged} message="Last Name cannot be empty" />
<ErrorMessage invalid={_.isEmpty(newBasicInfo.lastName) && componentMounted} message="Last Name cannot be empty" />
</div>
</div>
<div styleName="row">
Expand Down