feat: added ability to specify values for `form.reset` method #791
main fromrefs/pull/791/head·merged by Balastrong(GitHub profile, opens in a new tab) - 1
altexsoft-abel-teka(GitHub profile, opens in a new tab) approved these changes
Thanks for the PR, looks like a great starting point! Let me add a thought, this seems to me more like a
setAllthan a properreset, which I would expect also setting the new default values.Doing this (in two separate moments):
reset({ firstName: "foo" }) // Passing an object - set the new default reset() // No parameters - reset to defaultShould end up with the form this the state
{ firstName: "foo" }. At least as a default behaviour, then nothing stops us from adding an extra parameter with a flags, similar to RHF, to control that.What do you think?
a functionality like this would be pretty helpful.
☁️ Nx Cloud Report#
CI is running/has finished running commands for commit 5a66fd216a6f982d6236a69e0ecc4562f510a959. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 2 targets
Sent with 💌 from NxCloud.
Open in Stackblitz
More templates
- @tanstack/form-example-angular-array
- @tanstack/form-example-angular-simple
- @tanstack/form-example-angular-valibot
- @tanstack/form-example-angular-yup
- @tanstack/form-example-angular-zod
- @tanstack/form-example-lit-simple
- @tanstack/form-example-lit-ui-libraries
- @tanstack/form-example-react-array
- @tanstack/field-errors-from-form-validators
- @tanstack/form-example-react-next-server-actions
- @tanstack/form-example-react-query-integration
- @tanstack/form-example-react-simple
- @tanstack/form-example-react-tanstack-start
- @tanstack/form-example-react-ui-libraries
- @tanstack/form-example-react-valibot
- @tanstack/form-example-react-yup
- @tanstack/form-example-react-zod
- @tanstack/form-example-solid-array
- @tanstack/form-example-solid-simple
- @tanstack/form-example-solid-valibot
- @tanstack/form-example-solid-yup
- @tanstack/form-example-solid-zod
- @tanstack/form-example-vue-array
- @tanstack/form-example-vue-simple
- @tanstack/form-example-vue-valibot
- @tanstack/form-example-vue-yup
- @tanstack/form-example-vue-zod
@tanstack/angular-form
pnpm add https://pkg.pr.new/@tanstack/angular-form@791@tanstack/lit-form
pnpm add https://pkg.pr.new/@tanstack/lit-form@791@tanstack/form-core
pnpm add https://pkg.pr.new/@tanstack/form-core@791@tanstack/react-form
pnpm add https://pkg.pr.new/@tanstack/react-form@791@tanstack/solid-form
pnpm add https://pkg.pr.new/@tanstack/solid-form@791@tanstack/valibot-form-adapter
pnpm add https://pkg.pr.new/@tanstack/valibot-form-adapter@791@tanstack/vue-form
pnpm add https://pkg.pr.new/@tanstack/vue-form@791@tanstack/yup-form-adapter
pnpm add https://pkg.pr.new/@tanstack/yup-form-adapter@791@tanstack/zod-form-adapter
pnpm add https://pkg.pr.new/@tanstack/zod-form-adapter@791commit:
5a66fd2Codecov Report#
Attention: Patch coverage is
83.33333%with1 linein your changes missing coverage. Please review.Project coverage is 88.45%. Comparing base (
5473bb8) to head (5a66fd2). Report is 158 commits behind head on main.Files with missing lines Patch % Lines packages/form-core/src/FormApi.ts 83.33% 1 Missing :warning: Additional details and impacted files
@@ Coverage Diff @@ ## main #791 +/- ## ========================================== - Coverage 91.55% 88.45% -3.10% ========================================== Files 21 26 +5 Lines 900 1083 +183 Branches 206 269 +63 ========================================== + Hits 824 958 +134 - Misses 71 116 +45 - Partials 5 9 +4:umbrella: View full report in Codecov by Sentry. :loudspeaker: Have feedback on the report? Share it here.
Balastrong(GitHub profile, opens in a new tab) closed this
Sign in to join this conversation.
This would be nice!
Any ideas when this would be merged?