Skip to content
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

Fix validation documentation & Submission Errors Cannot Have Translatable Error Objects #6140

Merged
merged 3 commits into from
Apr 9, 2021

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Apr 9, 2021

In react-admin, errors might be objects with message and args properties which are used for translation.

The original final-form-submit-errors mutator was considering those errors as form nested fields such as name.message and name.args.

I introduced our own version of this mutator which detects those objects.

@djhi djhi added the RFR Ready For Review label Apr 9, 2021
@djhi djhi added this to the 3.14.3 milestone Apr 9, 2021
@djhi
Copy link
Collaborator Author

djhi commented Apr 9, 2021

@fzaninotto Should I target the next branch ?

@@ -1281,10 +1286,11 @@ export const UserCreate = (props) => (
<TextInput label="Email" source="email" validate={validateEmail} />
<TextInput label="Age" source="age" validate={validateAge}/>
<TextInput label="Zip Code" source="zip" validate={validateZipCode}/>
<SelectInput label="Sex" source="sex" choices={[
<SelectInput label="Genre" source="genre" choices={[
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo Genre => Gender

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You don't even wait for merged docs anymore 😂 Thanks!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tried to be more inclusive and ended up being even less than before 😱

@fzaninotto fzaninotto merged commit 6f5e64b into master Apr 9, 2021
@fzaninotto fzaninotto deleted the fix-validation-documentation branch April 9, 2021 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants