fix(listeners): rename onFieldUnmount to match that of the other listeners#2103
fix(listeners): rename onFieldUnmount to match that of the other listeners#2103harry-whorlow wants to merge 3 commits intomainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughA public API listener property was renamed from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
|
View your CI Pipeline Execution ↗ for commit 8c6cc3f
☁️ Nx Cloud last updated this comment at |
🚀 Changeset Version Preview1 package(s) bumped directly, 12 bumped as dependents. 🟨 Minor bumps
🟩 Patch bumps
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2103 +/- ##
==========================================
- Coverage 90.35% 90.24% -0.11%
==========================================
Files 38 49 +11
Lines 1752 2041 +289
Branches 444 532 +88
==========================================
+ Hits 1583 1842 +259
- Misses 149 179 +30
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Caution Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted. Error details |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/form-core/src/FormApi.ts (1)
310-327:⚠️ Potential issue | 🟡 MinorUpdate generated/reference API docs to prevent stale listener naming.
FormListenersnow exposesonUnmount, butdocs/reference/interfaces/FormListeners.mdstill showsonFieldUnmount. Please update/regenerate the reference docs so users don’t implement the old key.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/form-core/src/FormApi.ts` around lines 310 - 327, The reference docs are stale: the FormListeners interface now exposes onUnmount (in FormApi.ts) but docs/reference/interfaces/FormListeners.md still show onFieldUnmount; regenerate or update the generated reference markdown so the docs use onUnmount (and remove or alias onFieldUnmount if needed), ensuring the docs for FormListeners and examples/reference to onUnmount match the current FormApi declaration.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/form-core/src/FormApi.ts`:
- Around line 310-327: The reference docs are stale: the FormListeners interface
now exposes onUnmount (in FormApi.ts) but
docs/reference/interfaces/FormListeners.md still show onFieldUnmount; regenerate
or update the generated reference markdown so the docs use onUnmount (and remove
or alias onFieldUnmount if needed), ensuring the docs for FormListeners and
examples/reference to onUnmount match the current FormApi declaration.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b04a9c0e-18aa-4d14-b35a-31747bd896e2
📒 Files selected for processing (11)
.changeset/rename-onFieldUnmount-to-onUnmount.mddocs/framework/angular/guides/listeners.mddocs/framework/lit/guides/listeners.mddocs/framework/react/guides/listeners.mddocs/framework/solid/guides/listeners.mddocs/framework/svelte/guides/listeners.mddocs/framework/vue/guides/listeners.mdpackages/form-core/src/FieldApi.tspackages/form-core/src/FormApi.tspackages/form-core/tests/FieldApi.spec.tspackages/react-form/tests/useField.test.tsx
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.changeset/rename-onFieldUnmount-to-onUnmount.md:
- Line 2: The changeset incorrectly marks the rename of the public listener key
onFieldUnmount to onUnmount as a minor change; update the changeset in
.changeset/rename-onFieldUnmount-to-onUnmount.md to use a major release type (or
alternatively implement and document a backward-compatible alias that preserves
onFieldUnmount while introducing onUnmount) so existing consumers are not
broken—refer to the public listener key names onFieldUnmount and onUnmount and
ensure the changeset reflects the breaking change or that compatibility code is
added.
In `@docs/framework/angular/guides/listeners.md`:
- Around line 107-110: The docs incorrectly state that onSubmit only receives
formApi; update the listeners documentation so onSubmit lists both parameters
(formApi and meta) to match the FormListeners.onSubmit signature in FormApi.ts.
Locate the onSubmit entry in the listeners doc (near the onMount/onSubmit
section) and add "meta" to the parameter list and description so handler
examples and types match the FormListeners.onSubmit ({ formApi, meta }) usage.
In `@docs/framework/lit/guides/listeners.md`:
- Around line 97-100: The guide incorrectly documents the onSubmit listener as
taking only formApi; update the signature and examples to include the second
parameter meta (i.e., onSubmit(formApi, meta)) to match the core typing in
FormApi (see packages/form-core/src/FormApi.ts), and adjust adjacent example
wording to reference both formApi and meta where applicable.
In `@docs/framework/solid/guides/listeners.md`:
- Around line 98-101: The docs for Solid's listeners incorrectly list only
`formApi` for `onSubmit`; update the listeners.md entry so `onSubmit` is
documented as receiving `{ formApi, meta }` (matching the definition in
packages/form-core/src/FormApi.ts), describe `meta` briefly (e.g., submission
metadata such as submission count or validation state), and ensure the `onMount`
listing remains unchanged; locate the `onSubmit` listener section in
listeners.md and add `meta` to the parameter list and its short description.
In `@docs/framework/svelte/guides/listeners.md`:
- Around line 98-101: The docs incorrectly state that both onMount and onSubmit
listeners receive only formApi; update the listeners.md text to reflect that
onSubmit receives an object { formApi, meta } while onMount receives only
formApi — reference the implementation in packages/form-core/src/FormApi.ts and
the listener names onSubmit and onMount to locate the code that needs editing
and ensure the docs list formApi for onMount and { formApi, meta } for onSubmit.
🪄 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: 4f0920fd-b316-4bc9-b2a3-1f16da755ef1
📒 Files selected for processing (11)
.changeset/rename-onFieldUnmount-to-onUnmount.mddocs/framework/angular/guides/listeners.mddocs/framework/lit/guides/listeners.mddocs/framework/react/guides/listeners.mddocs/framework/solid/guides/listeners.mddocs/framework/svelte/guides/listeners.mddocs/framework/vue/guides/listeners.mdpackages/form-core/src/FieldApi.tspackages/form-core/src/FormApi.tspackages/form-core/tests/FieldApi.spec.tspackages/react-form/tests/useField.test.tsx
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| '@tanstack/form-core': minor | |||
There was a problem hiding this comment.
This rename is breaking; the release type should be major (or keep backward compatibility).
Line 2 marks this as minor, but removing/renaming a public listener key breaks existing consumers using onFieldUnmount.
Suggested changeset fix
-'@tanstack/form-core': minor
+'@tanstack/form-core': major📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| '@tanstack/form-core': minor | |
| '@tanstack/form-core': major |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.changeset/rename-onFieldUnmount-to-onUnmount.md at line 2, The changeset
incorrectly marks the rename of the public listener key onFieldUnmount to
onUnmount as a minor change; update the changeset in
.changeset/rename-onFieldUnmount-to-onUnmount.md to use a major release type (or
alternatively implement and document a backward-compatible alias that preserves
onFieldUnmount while introducing onUnmount) so existing consumers are not
broken—refer to the public listener key names onFieldUnmount and onUnmount and
ensure the changeset reflects the breaking change or that compatibility code is
added.
| `onMount` and `onSubmit` listeners have the following parameters: | ||
|
|
||
| - `formApi` | ||
|
|
There was a problem hiding this comment.
onSubmit callback params are documented incorrectly.
This section says onSubmit only receives formApi, but FormListeners.onSubmit in packages/form-core/src/FormApi.ts (Line 292-308) is typed as { formApi, meta }. Please update docs to list meta for onSubmit to avoid incorrect handler signatures.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/framework/angular/guides/listeners.md` around lines 107 - 110, The docs
incorrectly state that onSubmit only receives formApi; update the listeners
documentation so onSubmit lists both parameters (formApi and meta) to match the
FormListeners.onSubmit signature in FormApi.ts. Locate the onSubmit entry in the
listeners doc (near the onMount/onSubmit section) and add "meta" to the
parameter list and description so handler examples and types match the
FormListeners.onSubmit ({ formApi, meta }) usage.
| `onMount` and `onSubmit` listeners have the following parameters: | ||
|
|
||
| - `formApi` | ||
|
|
There was a problem hiding this comment.
onSubmit listener signature is incomplete in this guide.
onSubmit is documented as formApi-only, but core API typing in packages/form-core/src/FormApi.ts includes meta ({ formApi, meta }). Please correct this section and the adjacent example wording.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/framework/lit/guides/listeners.md` around lines 97 - 100, The guide
incorrectly documents the onSubmit listener as taking only formApi; update the
signature and examples to include the second parameter meta (i.e.,
onSubmit(formApi, meta)) to match the core typing in FormApi (see
packages/form-core/src/FormApi.ts), and adjust adjacent example wording to
reference both formApi and meta where applicable.
| `onMount` and `onSubmit` listeners have the following parameters: | ||
|
|
||
| - `formApi` | ||
|
|
There was a problem hiding this comment.
onSubmit parameter docs are missing meta.
The docs currently imply onSubmit gets only formApi, but packages/form-core/src/FormApi.ts defines onSubmit props as { formApi, meta }. Please document meta explicitly for Solid as well.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/framework/solid/guides/listeners.md` around lines 98 - 101, The docs for
Solid's listeners incorrectly list only `formApi` for `onSubmit`; update the
listeners.md entry so `onSubmit` is documented as receiving `{ formApi, meta }`
(matching the definition in packages/form-core/src/FormApi.ts), describe `meta`
briefly (e.g., submission metadata such as submission count or validation
state), and ensure the `onMount` listing remains unchanged; locate the
`onSubmit` listener section in listeners.md and add `meta` to the parameter list
and its short description.
| `onMount` and `onSubmit` listeners have the following parameters: | ||
|
|
||
| - `formApi` | ||
|
|
There was a problem hiding this comment.
Svelte docs also omit meta for onSubmit.
This section should not group onSubmit with onMount as formApi-only. Per packages/form-core/src/FormApi.ts, onSubmit receives { formApi, meta }. Please update to prevent incorrect implementations.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/framework/svelte/guides/listeners.md` around lines 98 - 101, The docs
incorrectly state that both onMount and onSubmit listeners receive only formApi;
update the listeners.md text to reflect that onSubmit receives an object {
formApi, meta } while onMount receives only formApi — reference the
implementation in packages/form-core/src/FormApi.ts and the listener names
onSubmit and onMount to locate the code that needs editing and ensure the docs
list formApi for onMount and { formApi, meta } for onSubmit.
2321807 to
d04ff1e
Compare
Summary by CodeRabbit
Breaking Changes
New Features
Documentation