Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 14 additions & 0 deletions src/libs/actions/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,19 @@ function clearContactMethodErrors(contactMethod, fieldName) {
});
}

/**
* Resets the state indicating whether a validation code has been sent to a specific contact method.
*
* @param {String} contactMethod - The identifier of the contact method to reset.
*/
function resetContactMethodValidateCodeSentState(contactMethod) {
Onyx.merge(ONYXKEYS.LOGIN_LIST, {
[contactMethod]: {
validateCodeSent: false,
},
});
}

/**
* Adds a secondary login to a user's account
*
Expand Down Expand Up @@ -827,4 +840,5 @@ export {
updateChatPriorityMode,
setContactMethodAsDefault,
updateTheme,
resetContactMethodValidateCodeSentState,
};
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ class ContactMethodDetailsPage extends Component {
};
}

componentDidMount() {
User.resetContactMethodValidateCodeSentState(this.getContactMethod());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Coming from #24521, this has caused a small regression
Full details can be found here, but in short we didn't check if the contact method exists before calling resetContactMethodValidateCodeSentState.
That meant you could edit URL to contain an invalid contact method and still proceed with the validation flow instead of being presented with the Not Found page

}

componentDidUpdate(prevProps) {
const errorFields = lodashGet(this.props.loginList, [this.getContactMethod(), 'errorFields'], {});
const prevPendingFields = lodashGet(prevProps.loginList, [this.getContactMethod(), 'pendingFields'], {});
Expand Down