Add preact integration for tanstack form#2043
Add preact integration for tanstack form#2043JoviDeCroock wants to merge 8 commits intoTanStack:mainfrom
Conversation
|
|
View your CI Pipeline Execution ↗ for commit 946e68a
☁️ Nx Cloud last updated this comment at |
theVedanta
left a comment
There was a problem hiding this comment.
compat and use-client are the only things I wanna flag, since they're in multiple files. Apart from that, looks okay. The onInput prop isn't important as such, but would be a nice-to-have.
| Field: FieldComponent< | ||
| TFormData, | ||
| TOnMount, | ||
| TOnChange, |
There was a problem hiding this comment.
I feel like fields should have an onInput prop instead of onChange for it to be consistent with Preact. If we can do that, it'd be awesome
There was a problem hiding this comment.
I don't think anyone would benefit from that, the end-user is still free to use onInput in exchange for onChange at their disposal
There was a problem hiding this comment.
Oh, gotcha. But how would users use onInput in parts of the API that are not the children?
<form.Field
name="firstName"
validators={{
onInput: ({ value }) =>
!value
? 'A first name is required'
: value.length < 3
? 'First name must be at least 3 characters'
: undefined,
}}
...I can understand if you feel like they don't, I was only thinking about it because of consistency with Preact's naming.
There was a problem hiding this comment.
Ah I see what you mean now, sorry I didn't derive the validator enforcement from the comment
There was a problem hiding this comment.
Validators should use onChange even on adapters that use onInput. That comes from core. No need to change :)
theVedanta
left a comment
There was a problem hiding this comment.
Once we can finalize this, let's get the docs in place and merge! Super excited to use preact-form 🔥
| Field: FieldComponent< | ||
| TFormData, | ||
| TOnMount, | ||
| TOnChange, |
There was a problem hiding this comment.
Oh, gotcha. But how would users use onInput in parts of the API that are not the children?
<form.Field
name="firstName"
validators={{
onInput: ({ value }) =>
!value
? 'A first name is required'
: value.length < 3
? 'First name must be at least 3 characters'
: undefined,
}}
...I can understand if you feel like they don't, I was only thinking about it because of consistency with Preact's naming.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2043 +/- ##
==========================================
- Coverage 90.35% 90.31% -0.04%
==========================================
Files 38 55 +17
Lines 1752 2148 +396
Branches 444 522 +78
==========================================
+ Hits 1583 1940 +357
- Misses 149 186 +37
- Partials 20 22 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🎯 Changes
@tanstack/preact-formpackage to the monorepo.@tanstack/preact-storeinstead of@tanstack/react-store.useIdfrompreact/hooksfor form ID generation.preactpeer dependency to>10.11.0for useId support.