Skip to content

Commit

Permalink
fix: Dimension values are correctly sorted in filters
Browse files Browse the repository at this point in the history
FIx #973
  • Loading branch information
ptbrowne committed Feb 24, 2023
1 parent ad0a9de commit 47825c9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/configurator/components/field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import {
useConfiguratorState,
} from "@/configurator/configurator-state";
import { FIELD_VALUE_NONE } from "@/configurator/constants";
import { DimensionValue } from "@/domain/data";
import { truthy } from "@/domain/types";
import { useTimeFormatLocale } from "@/formatters";
import { DimensionMetadataFragment, TimeUnit } from "@/graphql/query-hooks";
Expand Down Expand Up @@ -176,7 +175,10 @@ export const DataFilterSelect = ({

const sortedValues = useMemo(() => {
const sorters = makeDimensionValueSorters(dimension);
const sortedValues = orderBy(dimension.values, sorters) as DimensionValue[];
const sortedValues = orderBy(
dimension.values,
sorters.map((s) => (dv) => s(dv.label))
);

return sortedValues;
}, [dimension]);
Expand Down

0 comments on commit 47825c9

Please sign in to comment.