TanStack / TanStack/form

Devtools show null instead of NaN

Open
#1,781 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v1
Dominant language
TypeScript
Stars
6.7k
Forks
682
Avg merge
5d 18h
Merged PRs (30d)
7

Description

Describe the bug

I set the field to Number.NaN but in devtools I see null.

I set all number fields to NaN in tanstack form but I convert it to empty string when actually setting <input value={...} inside of my field.MyInput because that's what the "not set" value for all inputs is supposed to be in HTML for whatever reason, even for type="number".

Your minimal, reproducible example

too busy

Steps to reproduce

set some number to nan in default values and observe devtools

Expected behavior

value: NaN

actual: null (not even the value: part. Also for groups it'll show value: {null,null, "someStringField": "", null}

How often does this bug happen?

Every time

Screenshots or Videos
Image
Platform

mac, chrome

TanStack Form adapter

react-form

TanStack Form version

1.23.0

TypeScript version

5.9.2

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with Number.NaN in default values for the React form adapter, then inspect how the devtools output represents scalar and grouped values. Done means NaN is shown as value: NaN rather than null, including inside groups.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
devtools, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.