Skip to content

Commit

Permalink
feat: Only index values with identifier or position
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Feb 28, 2023
1 parent 7eca90e commit 36f3392
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion app/utils/sorting-values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ export const makeDimensionValueSorters = (
? dimension.values.map(addAlternateName)
: dimension.values;

const valuesByLabel = uniqueMapBy(values, (dv) => dv.label);
// Index values that have an identifier or a position
// Warning: if two values have the same label and have an identifier / position
// there could be problems as we could select the "wrong" value for the order
const valuesByLabel = uniqueMapBy(
values.filter((x) => x.identifier || x.position),
(dv) => dv.label
);

const getLabel = (label?: string) => label;
const getIdentifier = (label?: string) => {
Expand Down

1 comment on commit 36f3392

@vercel
Copy link

@vercel vercel bot commented on 36f3392 Feb 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

visualization-tool – ./

visualization-tool-git-main-ixt1.vercel.app
visualization-tool-alpha.vercel.app
visualization-tool-ixt1.vercel.app

Please sign in to comment.