form icon indicating copy to clipboard operation
form copied to clipboard

Bug: form.reset(value) seems not caring about value. It's reseting to the defaultValues anyway.

Open LumaKernel opened this issue 9 months ago • 2 comments

Describe the bug

I expected form.reset with the first arg, it resets with setting the default values to that arg, as written in JSDoc of the API.

But it seems resetting to the value as well as not supplying the arg.

Your minimal, reproducible example

https://github.com/LumaKernel/tanstack-form-issue-reset-with-values

Steps to reproduce

  1. Clone repro repo.
  2. npm i
  3. npm run dev
  4. Put values
  5. Submit
  6. Reset to the blank values.

Expected behavior

Reset to the value that is specified by arg. So, just the states reset.

How often does this bug happen?

Every time

Screenshots or Videos

https://github.com/user-attachments/assets/87e0afb2-3751-42db-980d-88b15115bb54

Platform

Node: v22.14.0 npm: 10.5.0

TanStack Form adapter

react-form

TanStack Form version

1.9.1

TypeScript version

5.8.3

Additional context

No response

LumaKernel avatar May 07 '25 08:05 LumaKernel

Hi @LumaKernel

Thanks for the issue! we'd prefer it if you create us a codeSandbox or a stackBlitz, anything that makes it easier for us to take a quick look to diagnose things makes our lives so much easier 😄 ... But, I checked it out and at least on the first pass this issue has merit.

From what I can see the reset is working correctly, at least on first pass, but then something else comes in and wipes the state and defaultValues.

harry-whorlow avatar May 07 '25 21:05 harry-whorlow

relates to https://github.com/TanStack/form/issues/1490

harry-whorlow avatar May 08 '25 16:05 harry-whorlow

#1494 has been merged. Update your Tanstack Form version to v1.14.1.

LeCarbonator avatar Jul 08 '25 05:07 LeCarbonator