From 1a01416be8254aba10dc0f617b0265542153f553 Mon Sep 17 00:00:00 2001 From: eireland Date: Mon, 29 Jan 2024 12:01:04 -0800 Subject: [PATCH] Changes Reset behavior to not close the modal and reset to default values instead of previously entered values --- src/components/attribute-filter.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/attribute-filter.tsx b/src/components/attribute-filter.tsx index adaea95..64bf950 100644 --- a/src/components/attribute-filter.tsx +++ b/src/components/attribute-filter.tsx @@ -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 = () => { @@ -294,7 +296,7 @@ const FilterModal = ({attr, position, targetFilterBottom, setShowFilterModal, se ; } else { return + defaultValue={`${Array.isArray(currentFilterValue) ? currentFilterValue[0] : "0"} ${currentAttr?.unit[units]}`}> ; } };