Skip to content

evaluate does not correctly compare objects which breaks formOptions updates #1628

@tcgj

Description

@tcgj

Describe the bug

This is essentially the same issue as TanStack/store#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

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