diff --git a/ui-v2/app/helpers/uniq-by.js b/ui-v2/app/helpers/uniq-by.js new file mode 100644 index 0000000000..c8c46ee027 --- /dev/null +++ b/ui-v2/app/helpers/uniq-by.js @@ -0,0 +1,13 @@ +import { helper } from '@ember/component/helper'; +import { isEmpty } from '@ember/utils'; +import { A as emberArray } from '@ember/array'; + +export function uniqBy([byPath, array]) { + if (isEmpty(byPath)) { + return []; + } + + return emberArray(array).uniqBy(byPath); +} + +export default helper(uniqBy); diff --git a/ui-v2/app/templates/dc/intentions/edit.hbs b/ui-v2/app/templates/dc/intentions/edit.hbs index 12d38a121f..d2f995a205 100644 --- a/ui-v2/app/templates/dc/intentions/edit.hbs +++ b/ui-v2/app/templates/dc/intentions/edit.hbs @@ -39,7 +39,7 @@