Skip to content

Commit

Permalink
Fixes the double input value when switching from between operator to …
Browse files Browse the repository at this point in the history
…any single value operator
  • Loading branch information
eireland committed Jan 26, 2024
1 parent 768c385 commit fb764a3
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 fb764a3

Please sign in to comment.