diff --git a/app/configurator/configurator-state.tsx b/app/configurator/configurator-state.tsx index 8c45f917a..ec2ad48c6 100644 --- a/app/configurator/configurator-state.tsx +++ b/app/configurator/configurator-state.tsx @@ -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, @@ -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({