form icon indicating copy to clipboard operation
form copied to clipboard

`evaluate` does not correctly compare objects which breaks formOptions updates

Open tcgj opened this issue 5 months ago • 1 comments

Describe the bug

This is essentially the same issue as https://github.com/TanStack/store/issues/218, but specific to useForm's form options updates. If default values were changed and the changed value is an object that does not return property keys via Object.keys—such as Date, File, or Temporal.Duration/Temporal.PlainDate—then evaluate returns true and shouldUpdateValues returns false. This causes the form API to not be updated, so nothing rerenders despite a prop change.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/modest-jang-4635xz

Steps to reproduce

  1. Create a field that uses one of these types of objects as a value. e.g. Temporal.Duration, or Date.
  2. Give it a default value
  3. Update the default value (without touching the input)

Expected behavior

The field should update its untouched default value accordingly to the updated default value.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Arc (Chromium)
  • Version: 138.0

TanStack Form adapter

react-form

TanStack Form version

v1.12.3

TypeScript version

v5.8.2

Additional context

No response

tcgj avatar Jul 23 '25 23:07 tcgj

Might want to reference for this update to shallow for evaluate.

https://github.com/TanStack/store/pull/222

tcgj avatar Sep 10 '25 22:09 tcgj