fix(form-core): fix broken sync/async validation state not shifting with array actions (remove,swap,shift,move...) #1324
main fromrefs/pull/1324/head·opened Previously we were using a cumulative field errors map maintained at the form api level. This PR removes that data structure in favor of a errorSourceMap data structure that lives within the FieldMeta for each field. This allows shifting/removing/deleting fields to automatically keep the errorSourceMap in sync.
This will fix #1323 and prevent other bugs from being raised around validation not working after other array actions like removing, shifting, swapping, moving, etc...
- 1
More templates
- @tanstack/form-example-angular-array
- @tanstack/form-example-angular-simple
- @tanstack/form-example-lit-simple
- @tanstack/form-example-lit-ui-libraries
- @tanstack/form-example-solid-array
- @tanstack/form-example-solid-simple
- @tanstack/form-example-react-array
- @tanstack/form-example-react-compiler
- @tanstack/field-errors-from-form-validators
- @tanstack/form-example-react-large-form
- @tanstack/form-example-react-next-server-actions
- @tanstack/form-example-react-query-integration
- @tanstack/form-example-remix
- @tanstack/form-example-react-simple
- @tanstack/form-example-react-standard-schema
- @tanstack/form-example-react-tanstack-start
- @tanstack/form-example-react-ui-libraries
- @tanstack/form-example-vue-array
- @tanstack/form-example-vue-simple
@tanstack/angular-form
npm i https://pkg.pr.new/@tanstack/angular-form@1324@tanstack/form-core
npm i https://pkg.pr.new/@tanstack/form-core@1324@tanstack/react-form
npm i https://pkg.pr.new/@tanstack/react-form@1324@tanstack/lit-form
npm i https://pkg.pr.new/@tanstack/lit-form@1324@tanstack/solid-form
npm i https://pkg.pr.new/@tanstack/solid-form@1324@tanstack/vue-form
npm i https://pkg.pr.new/@tanstack/vue-form@1324commit:
6e7a961Codecov Report#
Attention: Patch coverage is
96.77419%with1 linein your changes missing coverage. Please review.Project coverage is 88.88%. Comparing base (
4016a2b) to head (5e0f1ef). Report is 1 commits behind head on main.Files with missing lines Patch % Lines packages/form-core/src/FieldApi.ts 87.50% 1 Missing :warning: Additional details and impacted files
@@ Coverage Diff @@ ## main #1324 +/- ## ========================================== + Coverage 88.86% 88.88% +0.01% ========================================== Files 28 28 Lines 1275 1286 +11 Branches 332 340 +8 ========================================== + Hits 1133 1143 +10 - Misses 127 128 +1 Partials 15 15:umbrella: View full report in Codecov by Sentry. :loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
juanvilladev(GitHub profile, opens in a new tab) changed the title
juanvilladev(GitHub profile, opens in a new tab) changed the title
Async validation & sync validation now is fully synced and thoroughly tested with the new errorSourceMap. This reduces the complexity of using the cumulative errors map significantly and fixes all the issues with validations running on the wrong fields when removing/inserting/moving/shifting array fields.
Please review when you have time!
Thanks!
Whoops messed up the rebase, will fix tomorrow
Updated! Please review when you have time!
juanvilladev(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
View your CI Pipeline Execution ↗ for commit 6e7a961591e71ab156d193688dc9729238e2f0cd.
nx affected --targets=test:sherif,test:knip,tes...nx run-many --target=build --exclude=examples/**☁️ Nx Cloud last updated this comment at
2025-04-02 00:00:06UTC