From 0962aa8b50276eddb7c791a240eef242df5ab3c2 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Fri, 25 Oct 2024 16:35:17 -0700 Subject: [PATCH] Use separate variable for array and set of legend values This is easier for the compiler to understand. --- src/util/colorScale.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/colorScale.ts b/src/util/colorScale.ts index c7fdae483..d56c5a5b7 100644 --- a/src/util/colorScale.ts +++ b/src/util/colorScale.ts @@ -401,7 +401,7 @@ export function createVisibleLegendValues({ // filter according to scaleType, e.g. continuous is different to categorical which is different to boolean // filtering will involve looping over reduxState.tree.nodes and comparing with reduxState.tree.visibility if (scaleType === "ordinal" || scaleType === "categorical") { - let legendValuesObserved: string[] | Set = treeNodes + let legendValuesObserved: string[] = treeNodes .filter((n, i) => (!n.hasChildren && visibility[i]===NODE_VISIBLE)) .map((n) => genotype ? n.currentGt : getTraitFromNode(n, colorBy)); // if the 2nd tree is enabled, compute visible legend values and merge the values. @@ -411,8 +411,8 @@ export function createVisibleLegendValues({ .map((n) => genotype ? n.currentGt : getTraitFromNode(n, colorBy)); legendValuesObserved = [...legendValuesObserved, ...legendValuesObservedToo]; } - legendValuesObserved = new Set(legendValuesObserved); - const visibleLegendValues = legendValues.filter((v) => legendValuesObserved.has(v)); + const legendValuesObservedSet = new Set(legendValuesObserved); + const visibleLegendValues = legendValues.filter((v) => legendValuesObservedSet.has(v)); return visibleLegendValues; } }