fix(form-core): handle null field defaults #2429
main fromrefs/pull/2429/head·opened Summary#
- Fix
isDefaultValueto respect an explicit field-leveldefaultValue: null. - Update
resetFieldto fall back to the form-level default only when the field-level default isundefined. - Add a regression test covering field-level null defaults, value changes, and resets.
Fixes #2427
Summary by CodeRabbit#
- Bug Fixes
- Field-level
defaultValue: nullis now respected when checking whether a field has its default value and when resetting a field or form. Fields withundefineddefaults continue to use the form-level default.
- Field-level
- 1
Important
Review skipped#
Review was skipped as selected files did not have any reviewable changes.
Run configuration-
- Source mode: Auto
- Repository: TanStack/form
- Branch: main
- File: .coderabbit.yaml
- Commit: 314ea3b
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Advanced
- Run ID:
25f4fd20-a141-4db9-8c7e-86172ec72b62
Commits-
Reviewing files that changed from the base of the PR and between e7169e6846c3673c8adad3cb026fae894174336b and c63dfb06f739682a923665b1c99108a40397f51e.
You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
- 🔍 Trigger review
No actionable comments were generated in the recent review.
ℹ️ Recent review info
-
⚙️ Run configuration
-
- Configuration used: Repository: TanStack/form/.coderabbit.yaml
- Review profile: CHILL
- Plan: Advanced
- Run ID:
07ff809e-c847-46a6-9b72-3cf2bb2cc6e0
📥 Commits
-
Reviewing files that changed from the base of the PR and between 2216fdedf0a5ff17e4ef8567e1321442639b96ca and e7169e6846c3673c8adad3cb026fae894174336b.
📒 Files selected for processing (3)
-
.changeset/null-field-default-value.mdpackages/form-core/src/FormApi.tspackages/form-core/tests/FieldApi.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
-
Walkthrough
-
Field-level
defaultValue: nullis now used when resolvingisDefaultValueand whenresetFieldselects a value. Tests cover value changes, field reset, and form reset. A patch changeset describes the behavior.Changes: Field Default Resolution
Priority:Layer / File(s) Summary Resolve and reset nullable field defaults
packages/form-core/src/FormApi.ts,packages/form-core/tests/FieldApi.spec.ts,.changeset/null-field-default-value.mdDefault-status checks and resetFielduse a field-levelnulldefault. The tests verify the default status after value changes, field reset, and form reset. The changeset records the update. LowEstimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix · Severity of issue fixed: Low
Merge Risk:
Minimal · previous reviewe7169-
No actionable issue remains from this review; the change appears ready to merge after normal checks.
Pre-merge checks |
4 | 1-
❌ Failed checks (1 warning)#
Check name Status Explanation Resolution Description check The description explains the change, motivation, regression test, and linked issue. It does not use the required Changes, Checklist, or Release Impact sections, and it omits the required checklist and… Rewrite the description using the repository template. Add the Changes, Checklist, and Release Impact sections, then mark the applicable checklist items and confirm the changeset status. ✅ Passed checks (4 passed)
-
Check name Status Explanation Title check The title clearly and concisely describes the main change: handling null field defaults in form-core. Linked Issues check The PR addresses the coding requirements in #2427.FormApinow treats a field-leveldefaultValue: nullas the selected default and uses the form-level default only when the field default is `undef…Out of Scope Changes check The changes stay within the linked issue scope. The FormApifix implements null field-default handling, theFieldApitest verifies the regression, and the form-core changeset documents the behavio…Docstring Coverage No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 2…
Full details: Description check
-
Explanation
The description explains the change, motivation, regression test, and linked issue. It does not use the required Changes, Checklist, or Release Impact sections, and it omits the required checklist and release-impact selections.
-
✨ Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment `@coderabbitai help` to get the list of available commands.-
fenet-as(GitHub profile, opens in a new tab) linked this to fix #2427
Sign in to join this conversation.
🦋 Changeset detected#
Latest commit: c63dfb06f739682a923665b1c99108a40397f51e
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 14 packages
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR