Skip to content
Source
Sign inSign up
TanStack/form

[v2] Add a listener for array-level field changes #2300

OpenLeCarbonator(GitHub profile, opens in a new tab) opened this issue 0 comments

An array field's change listener runs whenever any of its subfields changes. However, consumers may only be interested in changes to the array itself, such as moving an item, rather than changes to the values inside each item.

It would be useful to provide a dedicated listener for these array-level operations. This would let consumers react to changes in the array's structure or ordering without also handling every nested field change.

Some thoughts

One possible implementation is to trigger the listener from changes to _arrayVersion. Whether that internal value should be exposed directly or used behind a higher-level listener API is open for discussion.

  1. LeCarbonator(GitHub profile, opens in a new tab) added labelstype: enhancement

  2. LeCarbonator(GitHub profile, opens in a new tab) added labelsscope: core

  3. LeCarbonator(GitHub profile, opens in a new tab) added labelsarea: runtime

  4. LeCarbonator(GitHub profile, opens in a new tab) added labelsarea: types

Sign in to join this conversation.