Skip to content

TypeScript errors and React setState console warning when adding an item to the array field #605

Description

@SergiuPlesco

Describe the bug

The bug comes form TypeScript in the form of red lines due to the type definitions mismatch and second one in the console from React: " Warning: Cannot update a component (Field) while rendering a different component (Field). To locate the bad setState() call inside Field, follow the stack trace as described...."

Your minimal, reproducible example

https://codesandbox.io/p/devbox/react-form-2n6vht

Steps to reproduce

  1. open console
  2. click Add new to do button
  3. see screenshots

Expected behavior

No errors or warnings in the console or files

How often does this bug happen?

Every time

Screenshots or Videos

image image image

Platform

macbook pro, m1
nextjs 14

Tanstack Form adapter

react-form

TanStack Form version

0.13.6

TypeScript version

5

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions