Skip to content

Field value change in FormGroup causes all fields in FormGroup to re-render #2377

Description

@PMudra

Describe the bug

When using a FormGroup, changing the value of a single field within the group causes the entire FormGroup and all its child components to re-render, even if those components don't use or reference the changed field. This differs from the behavior of standalone Field components, where only the specific field re-renders when its value changes.

Your minimal, reproducible example

https://codesandbox.io/p/devbox/floral-dust-hlznnr?workspaceId=ws_C5KaZaVHbgfPuxgKAM9hsh

Steps to reproduce

  1. Preview the provided codesandbox which is based on the "React Example: Multi Step Wizard" example code.
  2. Type in a value into one of the form fields of step 1.
  3. View the console output or use the React dev tools setting "Highlight updates when components render" to see which components will re-render.

Expected behavior

Similar to how individual Field components only re-render when their own value changes, a FormGroup should ideally only re-render the specific field that changed, not all child components within the group. This would allow heavy/complex components within a FormGroup to avoid unnecessary re-renders.

How often does this bug happen?

Every time

Screenshots or Videos

Image

Platform

OS: All platforms
Browser: All browsers
Version: N/A

TanStack Form adapter

react-form

TanStack Form version

1.33.5

TypeScript version

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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