payloadcms / payloadcms/payload
Conditionally disabling fields do not immediately update disability status
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Describe the Bug
I want to conditionally disable updates a collection field, based on the value set on another field. I've read this: https://payloadcms.com/community-help/discord/make-field-readonly-conditionally.
Unfortunately, this doesn't disable the fields immediately when I change the value of another field. Only after saving the page, it shows the desired result. Alternatively, I could use admin.condition, but I want the user to still read the value of the field, but unable to update it.
Link to the code that reproduces this issue
https://github.com/chrisvanmook/payload/tree/repro/conditional-disable-fields
Reproduction Steps
- Create a post
- Enter a value (except "test") as title (this should make the description field unable to update)
- Note nothing happens to the description field
- Save
- Now the field is disabled / unable to update
- Now try enabling it by entering "test" in the title field
- Note nothing happens to the description field
- Save
- Note nothing happens to the description field
- Hard refresh
- Now the description field is enabled
Which area(s) are affected? (Select all that apply)
area: ui, area: core, Not sure
Environment Info
WARN The "workspaces" field in package.json is not supported by pnpm. Create a "pnpm-workspace.yaml" file instead.
Binaries:
Node: 23.11.0
npm: 10.9.2
Yarn: N/A
pnpm: 9.9.0
Relevant Packages:
next: 15.3.2
payload: 3.42.0
@payloadcms/db-postgres: 3.42.0
@payloadcms/live-preview-react: 3.42.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
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): 32768
Available CPU cores: 10
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the conditional-disable reproduction branch linked in the issue and trace how the title field's value reaches the description field. Reproduce the behavior in the admin UI, then verify that changing the title immediately disables and re-enables the description without saving or refreshing, while preserving its readable value.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100