-
-
Notifications
You must be signed in to change notification settings - Fork 445
feat(form-core): add array method field.clearValues
and form.clearFieldValues
#1404
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
base: main
Are you sure you want to change the base?
Conversation
View your CI Pipeline Execution ↗ for commit 0c5b406.
☁️ Nx Cloud last updated this comment at |
The library already adds multiple helper functions for arrays ( Following this principle, I suggest there should be one (or optionally two) helper methods added in this PR:
|
The provided test case will always fail because the |
I'll rewrite the tests to use |
Sounds good. I got an implementation of clearValues ready for testing as well |
5ebd548
to
76cc154
Compare
Since we're adding two new methods, the title should be changed to feat(form-core) so that the bot creates the proper semantic versioning |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1404 +/- ##
==========================================
+ Coverage 88.52% 88.95% +0.42%
==========================================
Files 28 31 +3
Lines 1316 1394 +78
Branches 343 351 +8
==========================================
+ Hits 1165 1240 +75
- Misses 134 137 +3
Partials 17 17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
How should Currently:
With this information, I deduced that
Should
|
5aaa21c
to
3c2cfda
Compare
…FieldValues` Co-authored-by: LeCarbonator <18158911+LeCarbonator@users.noreply.github.com>
57f8294
to
1884b7b
Compare
field.clearValues
and form.clearFieldValues
Problem
When setting a field back to an empty array
items[0].firstName
would still exist - when there's a validation on the firstName (on the Field-level)form.canSubmit
would be false.Solution
Adding array method
field.clearValues
andform.clearFieldValues