Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Field validators receive no `path` while the form state is built (onChange)

Open
#18,873 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@RafalFilipek is already working on this.

Since Oct 20, 2026.

  • #18880 by @RafalFilipek — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
react, typescript
Domain
frontend, testing

Research direction

The missing path is in packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts; read the validate(...) call and compare it with fields/hooks/beforeChange/promise.ts and useField. The issue links a branch with a proposed one-line fix and a failing integration test. Confirm the test reproduces the missing path and that validation receives the expected array path after the change.

Written by the indexing model from the issue text.

Description

area: ui Bug created-by: Contributor
Describe the Bug

ValidateOptions.path is typed as required, and on submit Payload passes it (path: pathSegments in fields/hooks/beforeChange/promise.ts). On onChange it does not: the validate(...) call in packages/ui/src/forms/fieldSchemasToFormState/addFieldStatePromise.ts leaves path out.

So a validator that uses path, for example to find its own row in an array or block, gets undefined while the editor types. It works only on save.

Link to the code that reproduces this issue

https://github.com/RafalFilipek/payload/tree/fix/ui-validate-path-form-state

This branch has the proposed fix (one line) and an int test that fails without it. It passes path: path.split('.'), the same segments the server and useField use.

Reproduction Steps
{
  name: 'items',
  type: 'array',
  fields: [{
    name: 'text',
    type: 'text',
    validate: (value, { path }) => `Received path: ${JSON.stringify(path)}`,
  }],
}

Add a row and type into text.

Expected: ["items","0","text"], the same as on submit.

Actual: undefined.

Which area(s) are affected?

area: ui

Environment Info
Payload 4.0.0-beta, main

Generated by Claude Code

Dominant language
TypeScript
Stars
45.5k
Forks
4.3k
Avg merge
1d 19h
Merged PRs (30d)
295

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.