Skip to content

Commit

Permalink
feat: Use sort by for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
ptbrowne committed Sep 27, 2022
1 parent 3fc980f commit e62af4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/configurator/configurator-state.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import get from "lodash/get";
import mapValues from "lodash/mapValues";
import pickBy from "lodash/pickBy";
import setWith from "lodash/setWith";
import sortBy from "lodash/sortBy";
import { useRouter } from "next/router";
import {
createContext,
Expand Down Expand Up @@ -352,8 +353,8 @@ export const deriveFiltersFromFields = produce(
const isField = (iri: string) => fieldDimensionIris.has(iri);

// Apply hierarchical dimensions first
const sortedDimensions = [...dimensions].sort(
(a, b) => (a.hierarchy ? -1 : 1) - (b.hierarchy ? -1 : 1)
const sortedDimensions = sortBy(dimensions, (d) =>
d.hierarchy ? -1 : 1
);
sortedDimensions.forEach((dimension) =>
applyNonTableDimensionToFilters({
Expand Down

0 comments on commit e62af4d

Please sign in to comment.