Skip to content

Commit

Permalink
Changes Reset behavior to not close the modal and reset to default va…
Browse files Browse the repository at this point in the history
…lues instead of previously entered values
  • Loading branch information
eireland committed Jan 29, 2024
1 parent ff11742 commit 1a01416
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/components/attribute-filter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,10 @@ const FilterModal = ({attr, position, targetFilterBottom, setShowFilterModal, se
},[dropdownBottom, showOperatorSelectionModal, windowHeight]);

const handleReset = () => {
setOperator(currentAttrFilter?.operator || "equals");
setShowFilterModal(false);
setOperator("equals");
if (filterValueInputElRef.current) {
filterValueInputElRef.current.value = "0";
}
};

const handleSubmitFilter = () => {
Expand Down Expand Up @@ -294,7 +296,7 @@ const FilterModal = ({attr, position, targetFilterBottom, setShowFilterModal, se
</input>;
} else {
return <input ref={filterValueInputElRef} key={`${operator}-${units}`} className="filter-value"
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "100"} ${currentAttr?.unit[units]}`}>
defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "0"} ${currentAttr?.unit[units]}`}>
</input>;
}
};
Expand Down

0 comments on commit 1a01416

Please sign in to comment.