TanStack / TanStack/form

Custom Field Meta does not updated until input touched after 1.26.0

Open
#1,980 5 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 am using custom field meta's heavily, for example style={{ display: field.state.meta?.hidden ? 'none' : 'block' }}, for every field I have set of these meta's like dataSource, hidden, disabled, and others...

in example there is two field firstName and color, I have listener.onMount that hide firstName (through field.setMeta()) if color is "red", in v1.26.0 and before it works well, after this version it does not hide until I touch the field firstName

example use v1.26.0, change package version to see the problem

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-kqn6fekp?file=package.json,src%2Fsimple-form.tsx,src%2FApp.tsx&terminal=dev

Steps to reproduce
  1. notice in example field firstName is hidden by default (it is hidden in onMount)
  2. change the color to "green" field firstName will appear
  3. upgrade tanstack-form version to newer version
  4. after refresh you will notice firstName now is not hidden
  5. touch the field firstName now it will hide
Expected behavior

compare by previous steps I exp expect:

  1. notice in example field firstName is hidden by default (it is hidden in onMount)
  2. change the color to "green" field firstName will appear
  3. upgrade tanstack-form version to newer version
  4. field firstName should still hidden by default
How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • OS: [linux, windows]
  • Browsers: [chrome, vivaldi]
TanStack Form adapter

react-form

TanStack Form version

1.27.7

TypeScript version

5.9.3

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

Run the StackBlitz reproduction using the files named in package.json, src/simple-form.tsx, and src/App.tsx. Compare TanStack Form 1.26.0 with 1.27.7, following the onMount meta update and the firstName rendering behavior. Done means firstName is hidden initially and updates correctly when color changes without touching firstName.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.