Replies: 1 comment
-
Hey @mzronek — the The admin UI form itself can run without hooks at all, for example, when creating a new document. That means on create, for example, that data added via a hook will never be there. Instead, you should add your data via a virtual field ( Try that and let me know how it goes! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the Bug
We are filtering a relationship field using filterOptions with data, that is added to a document in an afterRead/beforeRead hook. Sometimes the data argument is passed with the enriched property, sometimes it is not. That results in the field entries not being filtered correctly. In my reproduction I also couldn't save the entry when the undefined filter removed all options from the field.
Link to the code that reproduces this issue
https://github.com/mzronek/payload-bug-filter
Reproduction Steps
Steps:
Result: Only shows a single user, although both should be shown.
Console shows: DATA FILTER undefined
To test beforeRead, comment afterRead hook, uncomment beforeRead hook in Test.ts.
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Beta Was this translation helpful? Give feedback.
All reactions