Skip to content

fix(react-form): remap listener paths in withFieldGroup #1654

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

kusiewicz
Copy link
Contributor

@kusiewicz kusiewicz commented Aug 1, 2025

Closes #1644

Currently, when using the withFieldGroup HOC, the field names provided in the validators.onChangeListenTo and validators.onBlurListenTo arrays are not remapped to their full paths within the form state. This causes linked field validation to fail, as the form cannot find the fields it's supposed to be listening to.

  • new method, remapFieldProps, has been added to the FieldGroupApi.
  • the useFieldGroup hook in @tanstack/react-form now calls this new core method for each Field and AppField rendered within the group.

Copy link

nx-cloud bot commented Aug 1, 2025

View your CI Pipeline Execution ↗ for commit e16ec4e

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

☁️ Nx Cloud last updated this comment at 2025-08-15 11:57:44 UTC

Copy link

pkg-pr-new bot commented Aug 1, 2025

More templates

@tanstack/angular-form

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

@tanstack/form-core

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

@tanstack/lit-form

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

@tanstack/react-form

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

@tanstack/solid-form

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

@tanstack/svelte-form

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

@tanstack/vue-form

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

commit: e16ec4e

Copy link

codecov bot commented Aug 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.61%. Comparing base (424c3c7) to head (e16ec4e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1654      +/-   ##
==========================================
+ Coverage   90.52%   90.61%   +0.09%     
==========================================
  Files          37       37              
  Lines        1688     1705      +17     
  Branches      421      425       +4     
==========================================
+ Hits         1528     1545      +17     
  Misses        143      143              
  Partials       17       17              

☔ 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.

@LeCarbonator
Copy link
Contributor

The function to remap listeners should go in form-core/FieldGroupApi instead.

However, I like the idea and approach! Let me know if you want help on this PR.

@kusiewicz kusiewicz force-pushed the field-group-mapping-fix branch from 9724dbe to 4725028 Compare August 1, 2025 21:18
@kusiewicz
Copy link
Contributor Author

The function to remap listeners should go in form-core/FieldGroupApi instead.

However, I like the idea and approach! Let me know if you want help on this PR.

Yes... make sense :) Updated and added tests

@kusiewicz kusiewicz force-pushed the field-group-mapping-fix branch 2 times, most recently from 9d5f447 to 1d5ce01 Compare August 14, 2025 14:44
@kusiewicz kusiewicz force-pushed the field-group-mapping-fix branch from 1d5ce01 to c7c1d84 Compare August 14, 2025 15:24
Copy link
Contributor

@LeCarbonator LeCarbonator left a comment

Choose a reason for hiding this comment

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

Just some minor things I'll jot down so I don't forget to do them. The new unit tests look good!

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.

[Docs] withFieldGroup corrections
2 participants