Skip to content

Commit

Permalink
fix: hide unusable fields from collection filter select (#6135)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessChowdhury committed May 3, 2024
1 parent 5c58bd3 commit 2be5ad0
Showing 1 changed file with 25 additions and 25 deletions.
Expand Up @@ -32,34 +32,34 @@ const reduceFields = (fields, i18n) =>
} else {
operators = fieldTypes[field.type].operators
}
}

const operatorKeys = new Set()
const filteredOperators = operators.reduce((acc, operator) => {
if (!operatorKeys.has(operator.value)) {
operatorKeys.add(operator.value)
return [
...acc,
{
...operator,
label: i18n.t(`operators:${operator.label}`),
},
]
const operatorKeys = new Set()
const filteredOperators = operators.reduce((acc, operator) => {
if (!operatorKeys.has(operator.value)) {
operatorKeys.add(operator.value)
return [
...acc,
{
...operator,
label: i18n.t(`operators:${operator.label}`),
},
]
}
return acc
}, [])

const formattedField = {
label: getTranslation(field.label || field.name, i18n),
value: field.name,
...fieldTypes[field.type],
operators: filteredOperators,
props: {
...field,
},
}
return acc
}, [])

const formattedField = {
label: getTranslation(field.label || field.name, i18n),
value: field.name,
...fieldTypes[field.type],
operators: filteredOperators,
props: {
...field,
},
return [...reduced, formattedField]
}

return [...reduced, formattedField]
return reduced
}, [])

/**
Expand Down

0 comments on commit 2be5ad0

Please sign in to comment.