form icon indicating copy to clipboard operation
form copied to clipboard

insertFieldValue replaces item instead of adding a new one and shift existing items

Open Balastrong opened this issue 1 year ago • 0 comments

Describe the bug

insertFieldValue (and insertValue) currently replaces the value at the given index.

Your minimal, reproducible example

https://stackblitz.com/edit/tanstack-form-tbctpy?file=src%2Findex.tsx

Steps to reproduce

  1. Click the "Insert Above" button
  2. Look at the input next to the button

Expected behavior

A new item is added to the array at the given index, previous items are not touched, subsequent items are shifted by 1 (to make room for the new item).

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

MacOS

TanStack Form adapter

react-form

TanStack Form version

0.19.4

TypeScript version

No response

Additional context

No response

Balastrong avatar May 02 '24 19:05 Balastrong