@@ -64,15 +68,18 @@ const Condition = (props) => {
/>
- console.log('changing value', newValue)}
+ dispatch({
+ type: 'update',
+ orIndex,
+ andIndex,
+ value: updatedValue || '',
+ }),
+ }}
/>
@@ -125,6 +132,7 @@ Condition.propTypes = {
dispatch: PropTypes.func.isRequired,
orIndex: PropTypes.number.isRequired,
andIndex: PropTypes.number.isRequired,
+ collectionSlug: PropTypes.string.isRequired,
};
export default Condition;
diff --git a/src/client/components/elements/WhereBuilder/index.js b/src/client/components/elements/WhereBuilder/index.js
index b4634cad1a..e3afcd336c 100644
--- a/src/client/components/elements/WhereBuilder/index.js
+++ b/src/client/components/elements/WhereBuilder/index.js
@@ -13,6 +13,7 @@ const WhereBuilder = (props) => {
const {
collection: {
fields,
+ slug,
labels: {
plural,
} = {},
@@ -26,13 +27,15 @@ const WhereBuilder = (props) => {
useEffect(() => {
setReducedFields(fields.reduce((reduced, field) => {
if (typeof fieldTypes[field.type] === 'object') {
+ const formattedField = {
+ label: field.label,
+ value: field.name,
+ ...fieldTypes[field.type],
+ };
+
return [
...reduced,
- {
- label: field.label,
- value: field.name,
- ...fieldTypes[field.type],
- },
+ formattedField,
];
}
@@ -74,6 +77,7 @@ const WhereBuilder = (props) => {
)}