Skip to content

Commit

Permalink
fix: tradeoffs filter lays out based on dupe nodes
Browse files Browse the repository at this point in the history
throws layout off
  • Loading branch information
keyserj committed Feb 14, 2024
1 parent 26d2a57 commit 3f4a4b6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/web/view/utils/filter.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uniqBy from "lodash/uniqBy";
import { z } from "zod";

import { RelationName, exploreRelationNames } from "../../../common/edge";
Expand Down Expand Up @@ -134,7 +135,11 @@ const applyTradeoffsFilter = (graph: Graph, filterOptions: TradeoffsOptions) =>
const solutionDetails =
filterOptions.detail === "none"
? []
: selectedSolutions.flatMap((solution) => ancestors(solution, graph, ["has", "creates"]));
: uniqBy(
// two solutions can share ancesotrs
selectedSolutions.flatMap((solution) => ancestors(solution, graph, ["has", "creates"])),
(node) => node.id
);

const criteriaIds = selectedCriteria.map((criterion) => criterion.id);
const filteredSolutionDetails =
Expand Down

0 comments on commit 3f4a4b6

Please sign in to comment.