form icon indicating copy to clipboard operation
form copied to clipboard

solved Devtools show null instead of NaN #1781

Open KirtiGautam620 opened this issue 1 month ago • 2 comments

Fix: Devtools show null instead of NaN (#1781)

Summary

This PR fixes an issue where TanStack Form Devtools incorrectly showed null for fields whose value was explicitly set to Number.NaN. This caused numeric fields that were intentionally initialized or updated to NaN to appear as null or even disappear in the Devtools UI, making debugging confusing.

The browser correctly treats <input type="number"> with value "" as "not set", so many users (including the reporter) map NaN -> "" when binding input values. However, inside the form state, TanStack Form should preserve the actual value NaN. Devtools was stringifying the value and normalizing it to null, leading to incorrect visualization.


Problem

When a field value is Number.NaN, Devtools displays:

KirtiGautam620 avatar Nov 18 '25 18:11 KirtiGautam620

⚠️ No Changeset found

Latest commit: b9487cc15e2985fdf66048b783e8f49bc6282e48

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Nov 18 '25 18:11 changeset-bot[bot]

@lachlancollins hi! i have worked and fixed this issue. kindly have a look over it and let me know what i can change. Thanks.

KirtiGautam620 avatar Nov 19 '25 14:11 KirtiGautam620