solved Devtools show null instead of NaN #1781
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:
⚠️ 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
@lachlancollins hi! i have worked and fixed this issue. kindly have a look over it and let me know what i can change. Thanks.