Skip to content

Fields with "appearance: drawer" do not re run the filter options after the user sets a value #15971

@lcnogueira

Description

@lcnogueira

Describe the Bug

When using filterOptions on a relationship field with admin.appearance: 'drawer', the filter function is only evaluated if a value is not set in the select/drawer. After a value is set in one field, that field will not re-trigger filterOptions on subsequent opens of the drawer.

This works correctly with the default select appearance: filterOptions is re-evaluated each time the dropdown is opened, reflecting the current form state. The bug is specific to appearance: 'drawer'.

Link to the code that reproduces this issue

https://github.com/lcnogueira/payload-bugs-and-features

Here is a quick video showing the issue: https://www.loom.com/share/27d6fdd2e01c4bee8522d9b81dbb907b

Reproduction Steps

  1. Clone the reproduction repo and start the project (docker compose up + npm run dev)
  2. Create a few testing users
  3. Go to /admin/collections/posts/create
  4. Open the relatedUser1 drawer — both users are listed (correct, filterOptions runs and relatedUser2 is empty so no filtering is applied)
  5. Select a user in relatedUser1
  6. Open the relatedUser2 drawer and confirm the data is filtered (correct behavior).
  7. Now, set a user in the relatedUser2 drawer and close it.
  8. Now open the relatedUser2 drawer again — the user selected in relatedUser1 should be filtered out.
    **Bug: it still shows the user selected on relatedUser1.
    ** filterOptions was not re-evaluated after the sibling value changed.
  9. For comparison, remove admin.appearance: 'drawer' from both fields and repeat — the default select dropdown correctly re-runs filterOptions each time it's opened regardless if there's a set value already.

Which area(s) are affected?

area: ui

Environment Info

Binaries:
  Node: 24.0.0
  npm: 11.3.0
  Yarn: 1.22.19
  pnpm: 10.14.0
Relevant Packages:
  payload: 3.79.1
  next: 15.4.11
  @payloadcms/db-mongodb: 3.79.1
  @payloadcms/graphql: 3.79.1
  @payloadcms/next/utilities: 3.79.1
  @payloadcms/richtext-lexical: 3.79.1
  @payloadcms/translations: 3.79.1
  @payloadcms/ui/shared: 3.79.1
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jan 19 21:56:28 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_ARM64_T6020
  Available memory (MB): 16384
  Available CPU cores: 10

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions