Skip to content

Commit

Permalink
Exclude repeatable field types from conditional logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sc0ttkclark committed Sep 13, 2023
1 parent 7186713 commit 2a11be3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ui/js/dfv/src/fields/conditional-logic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ const ConditionalLogic = ( {
} = fieldConfig;

const allAvailableFields = currentPodAllFields.filter( ( field ) => {
return ! UNSUPPORTED_FIELD_TYPES.includes( field.type ) && field.name !== affectedFieldName;
return (
! UNSUPPORTED_FIELD_TYPES.includes( field.type )
&& field.name !== affectedFieldName
&& (
'undefined' === typeof field?.repeatable
|| 0 === parseInt( field.repeatable )
)
);
} );

const [ conditions, setConditions ] = useState( {
Expand Down Expand Up @@ -235,6 +242,11 @@ const ConditionalLogic = ( {
return null;
}

// Don't render an option if it's repeatable.
if ( 'undefined' !== typeof field?.repeatable && 1 === parseInt( field.repeatable ) ) {
return null;
}

return (
<option
value={ field.name }
Expand Down

0 comments on commit 2a11be3

Please sign in to comment.