Passing optional client-side validation props into the formik config #1637
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Allows custom deposit forms the option of using formik's client-side validation, while changing nothing about the form's server-side validation.
Formik's client-side validation capabilities are currently not accessible to anyone who is building a custom deposit form (i.e., overriding the RDMDepositForm component). There is no way to pass the client-side validation props from RDMDepositForm through to formik. This commit makes client-side validation accessible by passing two props ("validate" and "validationSchema") into formik config via DepositFormApp and DepositBoostrap. This way developers can choose either to pass through a validation function or to pass through a yup schema which formik understands.
These two props default to undefined in which case they are ignored. They do not interfere at all with the current server-side validation. So there's no risk or negative side-effect to passing them through.
Checklist
Ticks in all boxes and 🟢 on all GitHub actions status checks are required to merge:
Third-party code
If you've added third-party code (copy/pasted or new dependencies), please reach out to an architect.
Reminder
By using GitHub, you have already agreed to the GitHub’s Terms of Service including that: