-
-
Notifications
You must be signed in to change notification settings - Fork 213
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
Merging of FieldState's error
and submitError
#95
Comments
This doesn't seem like a concern this library should dictate. Your concern is that you find yourself doing a lot of this? (react jsx syntax) <div>
{(error || submitError) && <Error>{error || submitError}</Error>}
</div> and you'd rather just do <div>
{mergedError && <Error>{mergedError}</Error>}
</div> ? |
Thanks for your response! To be honest, this issue was a bit… misguided. We've actually implemented We realised that it's correct (in our case) to always show the field validation I no longer believe it possible to "solve" this "problem" (if there even is one anymore) in a way that works for (or even helps) everyone in this library, so I'll just close it. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Are you submitting a bug report or a feature request?
Feature request
What is the current behavior?
FieldState
has separate fields forerror
andsubmitError
and no way to automatically merge them.What is the expected behavior?
Field
should be able to handle merging of theerror
andsubmitError
automatically, so the components may only handleerror
.From the perspective of all of my my projects', "merge" can be defined as "give
submitError
precedence". That is:I don't really see a case where you would have both a valuation error (
error
) and a submission error (submitError
), so perhaps they could just be one and the same from the get-go.However, if that's not an option (I realise that it is possible to have both validation and submission errors at the same time), this could be introduced as a non-breaking change by simply allowing a prop like
mergeErrors?: boolean
, or evenmergeErrors?: (validationError: ?any, submissionError: ?any) => resolvedError?: any
—or both.What's your environment?
This feature does not exist in the lastest release (4.4.0 at the time of writing).
The text was updated successfully, but these errors were encountered: