Fix handling of GraphQL schema-level validation errors in forms. Note: GraphQL errors currently happen before server-side validation errors, instead of happening at the same time.

This commit is contained in:
SachaG 2017-09-06 18:10:26 +02:00
parent 73edab4858
commit 1258619ef0
4 changed files with 12 additions and 3 deletions

View file

@ -14,7 +14,7 @@ const Flash = ({message, type}) => {
<li key={index}>{message.content}</li>
)}
</ul>
: <span>message.content</span>
: <span>{message.content}</span>
}
</Alert>
)

View file

@ -346,7 +346,7 @@ class Form extends Component {
let message;
if (error.data.errors) { // this error is a "multi-error" with multiple sub-errors
if (error.data && error.data.errors) { // this error is a "multi-error" with multiple sub-errors
message = error.data.errors.map(error => {
return {

View file

@ -155,6 +155,15 @@ div.ReactTags__suggestions mark{
display: none;
}
.form-errors{
.alert{
ul{
padding: 0 0 0 20px;
margin: 0;
}
}
}
.input-error{
color: #EF1642;
input, textarea, select{

View file

@ -64,7 +64,7 @@ export const getDefaultFragmentText = (collection, options = { onlyViewable: tru
/*
Exclude a field from the default fragment if
1. it has a resolver (unless addOriginalField is true)
1. it has a resolver and addOriginalField is false
2. it has $ in its name
3. it's not viewable (if onlyViewable option is true)