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

Validator Overhaul #527

Merged
merged 28 commits into from
Dec 11, 2023
Merged

Validator Overhaul #527

merged 28 commits into from
Dec 11, 2023

Conversation

crutchcorn
Copy link
Member

@crutchcorn crutchcorn commented Dec 3, 2023

This PR:

  • Renames onChange/onBlur/other validators to a validators={{onChange: () => void 0}} prefixed prop name
    • Update examples
    • Update tests
    • Update docs
  • Change validators to pass object instead of two arguments
    • Update docs
  • Renames validator (singular) to validatorAdapter
    • Update tests
    • Update docs
  • Updates onMount to match the other APIs
    • Update tests
  • Adds a createForm({validators: submit: () => void 0}) API
    • Write tests
  • Add async onSubmit validation (so that it calls onChange/onBlur)
    • Write tests
  • Add abort signal to async validators
    • Write tests
    • Write docs
  • Refactor FormAPI and FieldAPI validate and validateAsync to share code

Closes #491

Copy link

codesandbox-ci bot commented Dec 3, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@codecov-commenter
Copy link

codecov-commenter commented Dec 3, 2023

Codecov Report

Attention: 18 lines in your changes are missing coverage. Please review.

Comparison is base (c2f9957) 84.55% compared to head (4a74b6e) 93.78%.
Report is 62 commits behind head on main.

Files Patch % Lines
packages/form-core/src/FormApi.ts 93.10% 8 Missing ⚠️
packages/form-core/src/FieldApi.ts 96.42% 3 Missing ⚠️
packages/form-core/src/utils.ts 96.07% 2 Missing ⚠️
packages/react-form/src/useField.tsx 75.00% 2 Missing ⚠️
packages/solid-form/src/createField.tsx 96.55% 1 Missing ⚠️
packages/solid-form/src/createForm.tsx 92.30% 1 Missing ⚠️
packages/solid-form/src/formContext.ts 83.33% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #527      +/-   ##
==========================================
+ Coverage   84.55%   93.78%   +9.23%     
==========================================
  Files           9       21      +12     
  Lines         395      644     +249     
  Branches      109      156      +47     
==========================================
+ Hits          334      604     +270     
+ Misses         52       37      -15     
+ Partials        9        3       -6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@crutchcorn crutchcorn changed the title refactor!: move validators to prefixed property name [WIP] Validator Overhaul Dec 4, 2023
@crutchcorn
Copy link
Member Author

The TypeCheck CI is failing due to this upstream bug in Vue:

vuejs/language-tools#3782

@crutchcorn crutchcorn changed the title [WIP] Validator Overhaul Validator Overhaul Dec 10, 2023
@crutchcorn crutchcorn marked this pull request as ready for review December 10, 2023 06:30
@aadito123
Copy link
Member

Looks great!

@crutchcorn crutchcorn merged commit bc270fb into main Dec 11, 2023
6 checks passed
@crutchcorn crutchcorn deleted the rename-validators branch December 11, 2023 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rename Validators to Avoid DOM Event Confusion
3 participants