You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fields with custom components ignore admin condition #453
This has 2 fields with the same condition - a regular text field, and a text field with a custom component.
The field with the custom component always renders, regardless of the condition outcome.
Hey @oranoran — this should actually be documented but it is actually functioning as intended, however the intended functionality could be up for debate.
Right now, we export withCondition as a HOC from payload/components/forms. You can wrap your custom component with this HOC and then boom - conditions work.
The question is - should this be done for you? The reason that we did not auto-wrap custom components in withCondition is because sometimes you might want to control conditions yourself as part of the custom component - for example, this discussion.
I'll move this over to a discussion but I'd like to keep the convo going!
Activity
jmikrut commentedon Feb 15, 2022
Hey @oranoran — this should actually be documented but it is actually functioning as intended, however the intended functionality could be up for debate.
Right now, we export
withConditionas a HOC frompayload/components/forms. You can wrap your custom component with this HOC and then boom - conditions work.The question is - should this be done for you? The reason that we did not auto-wrap custom components in
withConditionis because sometimes you might want to control conditions yourself as part of the custom component - for example, this discussion.I'll move this over to a discussion but I'd like to keep the convo going!