Skip to content

useFormFields() rerenders on unrelated field changes #14213

@jessrynkar

Description

@jessrynkar

Describe the Bug

Our docs state that the useFormFields hook 'will only re-render when that field's state changes', but currently any change to any field in the form triggers a re-render.

Image

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/tree/fix/use-field-rerendering

Reproduction Steps

  1. checkout branch fix/use-field-rerendering
  2. run _community test suite
  3. go to posts
  4. open console to see logs
  5. type into the non-custom field title and expect the console log not to fire

You can then go to the file test/_community/components/CustomTextFieldClient, comment out the useFormFields() and uncomment the useField() to test this hook, repeat the steps above and see it fires when any field changes instead of the just the requested field.

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 23.11.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 9.7.1
Relevant Packages:
  payload: 3.59.1
  @payloadcms/payload-cloud: 3.59.1
Operating System:
  Platform: darwin
  Arch: x64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:49 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6000
  Available memory (MB): 16384
  Available CPU cores: 10

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions