Skip to content

Commit

Permalink
Merge pull request #35 from concord-consortium/186926233-fix-filter-i…
Browse files Browse the repository at this point in the history
…nput-change

Fixes the double input value when switching from between operator to …
  • Loading branch information
eireland authored Jan 29, 2024
2 parents a79afab + fb764a3 commit c431602
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/attribute-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,13 @@ const FilterModal = ({attr, position, targetFilterBottom, setShowFilterModal, se
} else if (operator === "aboveMean" || operator === "belowMean") {
return null;
} else if (operator === "top" || operator === "bottom") {
return <input ref={filterValueTopBottomInputElRef} key={`${operator}-${units}`} className="filter-value" defaultValue={`${currentFilterValue || "100"}`}></input>;
return <input ref={filterValueTopBottomInputElRef} key={`${operator}-${units}`} className="filter-value"
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "100"}`}>
</input>;
} else {
return <input ref={filterValueInputElRef} key={`${operator}-${units}`} className="filter-value" defaultValue={`${currentFilterValue} ${currentAttr?.unit[units]}`}></input>;
return <input ref={filterValueInputElRef} key={`${operator}-${units}`} className="filter-value"
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "100"} ${currentAttr?.unit[units]}`}>
</input>;
}
};

Expand Down

0 comments on commit c431602

Please sign in to comment.