Skip to content
Source
Sign inSign up
TanStack/form

replaceFieldValue ignoring dontUpdateMeta config option #1146

Send to my agent
Closedjuanvilladev(GitHub profile, opens in a new tab) opened this issue 2 comments

Describe the bug

When replacing an array object using the replaceFieldValue api, meta object for underlying fields is being updated despire the option dontUpdateMeta.

Your minimal, reproducible example

https://stackblitz.com/edit/vitejs-vite-iqkcjas5?file=src%2Fcomponents%2FForm.tsx

Steps to reproduce

On my preview, notice how dontUpdateMeta is set to true, yet as soon as we click on the replace item button, we see isTouched equals true.

Expected behavior

Upon exeucting form.replaceFieldValue with config option dontUpdateMeta, the meta of the underlying fields replaced, is NOT touched.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

Platform agnostic as it's easily reproducible in Stackblitz link.

TanStack Form adapter

None

TanStack Form version

v0.41.3

TypeScript version

~5.7.2

Additional context

From looking into this, when calling replaceFieldValue, we're always forcibly validating the underlying fields here.

Then within the validateField function, we always mark as touched. See here.

  1. Just as a heads up - you should now be using dontUpdateMeta in any capacity. What are you trying to achieve from a UX perspective?

  2. crutchcorn(GitHub profile, opens in a new tab) added labelsquestion

  3. Closing, until we can figure out what the intended usage for dontUpdateMeta is in app code from OP

Sign in to join this conversation.