Skip to content

fix: remove errant Field.Field usage#2149

Open
crutchcorn wants to merge 1 commit intomainfrom
remove-dupe-field
Open

fix: remove errant Field.Field usage#2149
crutchcorn wants to merge 1 commit intomainfrom
remove-dupe-field

Conversation

@crutchcorn
Copy link
Copy Markdown
Member

@crutchcorn crutchcorn commented May 6, 2026

This PR removes the ability to do:

<form.Field children={field => <field.Field/>}/>

Which I think was errantly added, as I can't think of any reliable reason why we'd want to support this.

Summary by CodeRabbit

  • Breaking Changes
    • The useField hook's public API has been simplified. The Field sub-component is no longer exposed on the returned value. Users will need to update code that relied on accessing Field through the hook's return object.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

📝 Walkthrough

Walkthrough

The PR simplifies the useField hook's public API by removing the ReactFieldApi extension from its return type, eliminating the explicit Field sub-component exposure. React imports are adjusted to remove useRef and add ReactNode and FunctionComponent.

Changes

useField Hook API Simplification

Layer / File(s) Summary
Import Updates
packages/react-form/src/useField.tsx
Removed useRef from React imports; added ReactNode, FunctionComponent imports and explicit UseFieldOptions, UseFieldOptionsBound type imports from ./types.
Type Definition
packages/react-form/src/useField.tsx
Replaced the extended API type that intersected ReactFieldApi with a direct FieldApi type, eliminating the Field sub-component augmentation from the return type.
Implementation
packages/react-form/src/useField.tsx
Removed the explicit assignment of the Field sub-component on the returned API object.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit hops through types with glee,
Removing what we don't quite need to see,
ReactFieldApi fades away,
The API surface cleaner every day! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains what was removed and why, but is missing the required template sections (🎯 Changes details, ✅ Checklist, and 🚀 Release Impact information). Add the standard template sections including a detailed Changes section, complete the Checklist items, and specify the Release Impact (whether a changeset was generated).
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: removing errant Field.Field usage, which aligns with the PR's objective to eliminate the nested Field pattern.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch remove-dupe-field

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 6, 2026

View your CI Pipeline Execution ↗ for commit 426097e

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 58s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 12s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-06 09:54:05 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 6, 2026

More templates

@tanstack/angular-form

npm i https://pkg.pr.new/@tanstack/angular-form@2149

@tanstack/form-core

npm i https://pkg.pr.new/@tanstack/form-core@2149

@tanstack/form-devtools

npm i https://pkg.pr.new/@tanstack/form-devtools@2149

@tanstack/lit-form

npm i https://pkg.pr.new/@tanstack/lit-form@2149

@tanstack/react-form

npm i https://pkg.pr.new/@tanstack/react-form@2149

@tanstack/react-form-devtools

npm i https://pkg.pr.new/@tanstack/react-form-devtools@2149

@tanstack/react-form-nextjs

npm i https://pkg.pr.new/@tanstack/react-form-nextjs@2149

@tanstack/react-form-remix

npm i https://pkg.pr.new/@tanstack/react-form-remix@2149

@tanstack/react-form-start

npm i https://pkg.pr.new/@tanstack/react-form-start@2149

@tanstack/solid-form

npm i https://pkg.pr.new/@tanstack/solid-form@2149

@tanstack/solid-form-devtools

npm i https://pkg.pr.new/@tanstack/solid-form-devtools@2149

@tanstack/svelte-form

npm i https://pkg.pr.new/@tanstack/svelte-form@2149

@tanstack/vue-form

npm i https://pkg.pr.new/@tanstack/vue-form@2149

commit: 426097e

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/react-form/src/useField.tsx`:
- Line 275: The PR removed the ReactFieldApi augmentation and the
extendedApi.Field assignment which breaks consumers using field.Field (e.g., in
<form.Field>{(field) => <field.Field .../>}</form.Field>); update the release
notes and migration guide and ensure the commit includes a Conventional Commits
breaking change marker (either use fix!: or add a BREAKING CHANGE: footer) that
explains the removal, cites the affected symbols (ReactFieldApi,
extendedApi.Field, field.Field), and documents the recommended replacements (use
the outer form.Field or call useField directly) with a short example and any
migration steps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 25919c7d-28c0-465a-abc8-bcd99ea17f73

📥 Commits

Reviewing files that changed from the base of the PR and between 93be6f0 and 426097e.

📒 Files selected for processing (1)
  • packages/react-form/src/useField.tsx

> = reactiveFieldApi as never

extendedApi.Field = Field as never
> = reactiveFieldApi as never
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Document the breaking removal of field.Field in release notes / migration guide.

Dropping the ReactFieldApi augmentation and the extendedApi.Field = … assignment is a public-API breaking change: any consumer using <form.Field>{(field) => <field.Field …/>}</form.Field> will now see a runtime TypeError: field.Field is not a function (and a TS error). The PR title is fix:, but per Conventional Commits this should be surfaced as a breaking change (e.g. fix!: or a BREAKING CHANGE: footer) so the changeset/semver bump and migration notes are generated correctly. Worth calling out the recommended replacement (use the outer form.Field or useField directly) in the changelog.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/react-form/src/useField.tsx` at line 275, The PR removed the
ReactFieldApi augmentation and the extendedApi.Field assignment which breaks
consumers using field.Field (e.g., in <form.Field>{(field) => <field.Field
.../>}</form.Field>); update the release notes and migration guide and ensure
the commit includes a Conventional Commits breaking change marker (either use
fix!: or add a BREAKING CHANGE: footer) that explains the removal, cites the
affected symbols (ReactFieldApi, extendedApi.Field, field.Field), and documents
the recommended replacements (use the outer form.Field or call useField
directly) with a short example and any migration steps.

@sentry
Copy link
Copy Markdown

sentry Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 56.85%. Comparing base (6892ed0) to head (426097e).
⚠️ Report is 172 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2149       +/-   ##
===========================================
- Coverage   90.35%   56.85%   -33.50%     
===========================================
  Files          38       18       -20     
  Lines        1752      248     -1504     
  Branches      444       47      -397     
===========================================
- Hits         1583      141     -1442     
+ Misses        149       92       -57     
+ Partials       20       15        -5     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

1 participant