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; } }