Skip to content

form.reset(value) is not resetting defaultValues to a provided value #1490

@ilialksv

Description

@ilialksv

Describe the bug

It seems like form.reset(value) is updating defaultValues, but by the next render defaultValues are being reset to the initially provided ones. So, as a result, there is no difference whether to call form.reset(value) or just form.reset() because they lead to the same result.

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-x8k3rfrs?file=src%2FApp.tsx

Steps to reproduce

  1. Go to the Stackblitz url.
  2. Change values in input(s).
  3. Click "Submit" button.
  4. After submit, defaultValues are being reset to the new ones (you can see it in console).
  5. By the next render, defaultValues are back to the initial ones.

Expected behavior

As a user I expect that defaultValues are updated with the values provided to form.reset method and not being reset to the initial defaultValues.

How often does this bug happen?

Every time

Screenshots or Videos

no-reset.mp4

Platform

  • OS: Windows 11
  • Browser: Chrome
  • Version: 135.0.7049.116

TanStack Form adapter

react-form

TanStack Form version

v1.9.1

TypeScript version

v5.8.3

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions