You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-10 09:22:25 +03:00
Clarify finding first non-null field error
This commit is contained in:
@@ -289,8 +289,11 @@ module.exports = React.createClass({
|
||||
},
|
||||
|
||||
onFormValidationChange: function(fieldErrors) {
|
||||
// Find the first error and show that.
|
||||
const errCode = Object.values(fieldErrors).find(value => value);
|
||||
// `fieldErrors` is an object mapping field IDs to error codes when there is an
|
||||
// error or `null` for no error, so the values array will be something like:
|
||||
// `[ null, "RegistrationForm.ERR_PASSWORD_MISSING", null]`
|
||||
// Find the first non-null error code and show that.
|
||||
const errCode = Object.values(fieldErrors).find(value => !!value);
|
||||
if (!errCode) {
|
||||
this.setState({
|
||||
errorText: null,
|
||||
|
||||
Reference in New Issue
Block a user