Skip to content

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

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

Activity

  1. tcgj commented on Sep 10, 2025

    @tcgj
    Author

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

    TanStack/store#222

  2. andyGallagher commented on Jan 20, 2026

    @andyGallagher

    Wondering if there is any progress on this, or general guidance on how to use a form that has field values that are a Date or Temporal? Field state values not being reliably updated here definitely causes unexpected behavior.

  3. GiacoCorsiglia commented on Jan 20, 2026

    @GiacoCorsiglia

    In lieu of direct Temporal support, it might be nice to have a general mechanism for either supporting a custom comparator, or looking for a special object._tanstackComparisonValue() on objects. Then at least we could patch the Temporal prototypes with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugThis is a bug in behaviour.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions