Skip to content

Infinite loop error occurs when deleting/clearing a field with a numeric key #1888

@hoqn

Description

@hoqn

Describe the bug

When the form value is an object and the field being accessed has numeric keys, I cannot call deleteField or clearFieldValues.

an exception occurs: "It seems we have created an infinite loop in deleteBy."

Your minimal, reproducible example

https://codesandbox.io/p/sandbox/relaxed-kirch-hjgm8s

Steps to reproduce

  1. Configure the form value to contain elements with numeric keys in the path, such as { a: { 123: [] } }.
  2. Call deleteField('a.123').
  3. An error occurs.

Expected behavior

Errors must not occur.

How often does this bug happen?

None

Screenshots or Videos

Image

Platform

  • OS: macOS
  • Browser: Chrome

TanStack Form adapter

react-form

TanStack Form version

1.26.0

TypeScript version

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions