Skip to content
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

feat: added ability to specify values for form.reset method #791

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

vara855
Copy link
Contributor

@vara855 vara855 commented Jun 28, 2024

@thomasvt1
Copy link

This would be nice!

Any ideas when this would be merged?

Copy link
Member

@Balastrong Balastrong left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, looks like a great starting point!
Let me add a thought, this seems to me more like a setAll than a proper reset, 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 default

Should 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?

@zwenger
Copy link

zwenger commented Oct 28, 2024

a functionality like this would be pretty helpful.

Copy link

nx-cloud bot commented Nov 12, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 5a66fd2. 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.

Copy link

pkg-pr-new bot commented Nov 12, 2024

Open in Stackblitz

More templates

@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@791

commit: 5a66fd2

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in 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 ⚠️
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     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Balastrong Balastrong merged commit 576cd83 into TanStack:main Nov 12, 2024
5 of 7 checks passed
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.

5 participants