Repository navigation
Conversation
The app form replaces `Field` with a component that provides the field context, but keeps the plain `ArrayField`, so a registered field component rendered inside `form.ArrayField` or a form group's `ArrayField` throws "Field components must be used within a `form.Field` component", although the types offer it there. Let `createFieldWithContext` take the field subscription and use it with the array subscription for both, in React and Preact. Solid and Vue already provide the context for arrays.
🦋 Changeset detectedLatest commit: deafb2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
🎯 Changes
With
createFormHook, a registered field component insideform.ArrayField(or a form group'sArrayField) throwsTanStack Form: Field components must be used within a `form.Field` component.The types allow this: react-form's own type test renders<field.feedback.FieldInfo />insideform.ArrayField(createFormHook.test-d.tsx#L213-L216).The app form only wraps
FieldwithcreateFieldWithContext(ReactAppFormApi.lib.ts#L50-L58), soArrayFieldand the groupArrayFieldnever provideFieldContext. Preact has the same gap; Solid and Vue already provide the context there.createFieldWithContextnow takes the field subscription hook (defaultuseValueFieldSubscription) and both array components passuseArrayFieldSubscription, so they still rerender only on length and_arrayVersionchanges. Same fix in Preact, whose groupArrayFieldgoes throughform.ArrayField. Also updated thefieldComponentJSDoc.Added a test per adapter in
createFormHook.spec.tsx: a field component insideform.ArrayFieldand inside a groupArrayFieldrenders, updates afterpushValue, and a child value change doesn't rerender the array children. Onalphait fails in React (normal and strict) and Preact with:It passes with the fix, and
pnpm test:prpasses locally (28 projects affected).✅ Checklist
pnpm test:pr, or these tests do not apply to this pull request.🚀 Release Impact
Summary by CodeRabbit