Closed thgh closed 1 year ago
Hey @thgh,
I'm hesitant to do any removal of fields from the selector. I'll explain a little on how this works and then we can figure out if there is anything to do here.
When bulk editing the UI can only use the fields that you give it. Obviously this has implications for things like field validation and conditions. Since it can't pull all the data for docs to do it dynamically, we're only able to work with the fields you have selected and use that, validation we don't even bother with since it would be incomplete. Conditions we left in. I considered bypassing it entirely, but we opted to say you have to add the fields you depend on for this. A typical use of conditions will have field B depends on the value from field A, so in this case to edit both A and B in your bulk edit to work with the conditional field B.
Your reproduction example isn't realistic since you're only returning false
in your condition. If you really did want this, you could disable the field from bulk edit entirely with admin.disableBulkEdit
.
Now with that all laid out, I don't know that it would be a great UX for the condition to apply to fields before a user has made selections. It would be a challenge to users to have to pick all the fields that a field depends on, fill it in, then go back to the field selector dropdown to look for the conditional field again, hoping they have met those conditions to then select it.
I'd be more inclined to show a placeholder for the field that indicates that the field is currently not available if the condition fails. That said, it would take a bit of work and I don't feel that this should be prioritized really.
I'm going to close this issue, but we can reopen or spawn a new discussion from this issue if you think there is a feature to be built.
What do you think?
👍 I think a placeholder or warning that the field is hidden would be better UX. (low prio)
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.
Link to reproduction
UI
To Reproduce
Create a field
Expected: cannot find the field Actual: field is selected but nothing happens
Describe the Bug
If payload is smart enough to hide conditioned fields after selecting it, it can be smart enough to remove it from the field selection in the first place.
Payload Version
1.11.3