-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fields with "appearance: drawer" do not re run the filter options after the user sets a value #15971
Copy link
Copy link
Open
Labels
Description
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
- Clone the reproduction repo and start the project (
docker compose up+npm run dev) - Create a few testing users
- Go to
/admin/collections/posts/create - Open the relatedUser1 drawer — both users are listed (correct,
filterOptionsruns andrelatedUser2is empty so no filtering is applied) - Select a user in relatedUser1
- Open the relatedUser2 drawer and confirm the data is filtered (correct behavior).
- Now, set a user in the relatedUser2 drawer and close it.
- Now open the relatedUser2 drawer again — the user selected in
relatedUser1should be filtered out.
**Bug: it still shows the user selected onrelatedUser1.
**filterOptionswas not re-evaluated after the sibling value changed. - For comparison, remove
admin.appearance: 'drawer'from both fields and repeat — the default select dropdown correctly re-runsfilterOptionseach 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
Reactions are currently unavailable