diff --git a/webapp/components/DataQuery/ButtonBar/ButtonSort/SortEditor/SortEditor.js b/webapp/components/DataQuery/ButtonBar/ButtonSort/SortEditor/SortEditor.js index 3363aebcf0..ad48fdaed8 100644 --- a/webapp/components/DataQuery/ButtonBar/ButtonSort/SortEditor/SortEditor.js +++ b/webapp/components/DataQuery/ButtonBar/ButtonSort/SortEditor/SortEditor.js @@ -4,7 +4,6 @@ import PropTypes from 'prop-types' import { Button } from '@webapp/components/buttons' import PanelRight from '@webapp/components/PanelRight' -import { useI18n } from '@webapp/store/system' import { Sort, SortCriteria } from '@common/model/query' import { useSortEditor } from './store' @@ -13,11 +12,10 @@ import SortCriteriaEditor from './SortCriteriaEditor' const SortEditor = (props) => { const { onChange, onClose, query } = props - const i18n = useI18n() const { draft, sort, sortDraft, setSortDraft, variables, variablesAvailable } = useSortEditor({ query }) return ( - +
{sortDraft.map((sortCriteria, idx) => ( }) if (Objects.isEmpty(attributeDefUuids)) return variables - const variablesByUuid = ObjectUtils.toUuidIndexedObj(variables) + const variablesByUuid = variables.reduce((acc, variable) => { + const { uuid } = variable + if (!acc[uuid]) { + // keep only first variable + // variables for composite attributes have same UUID for different properties (e.g. taxon) + acc[uuid] = variable + } + return acc + }, {}) return attributeDefUuids.map((uuid) => variablesByUuid[uuid]).filter(Boolean) }