Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Balastrong opened this issue May 2, 2024 · 0 comments · May be fixed by #697
Open

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

Balastrong opened this issue May 2, 2024 · 0 comments · May be fixed by #697

Comments

@Balastrong
Copy link
Contributor

Balastrong commented May 2, 2024

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 Balastrong changed the title insertValue replaces item instead of adding a new one and shift existing items insertFieldValue replaces item instead of adding a new one and shift existing items May 2, 2024
@Balastrong Balastrong linked a pull request May 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant