Explorar o código

Reset group filter values when toggling switch

Tatiana Inama %!s(int64=6) %!d(string=hai) anos
pai
achega
e1ad45bac3
Modificáronse 1 ficheiros con 7 adicións e 4 borrados
  1. 7 4
      src/Admin.tsx

+ 7 - 4
src/Admin.tsx

@@ -215,7 +215,10 @@ const FilterPanel: React.FunctionComponent<{
     }
     
     if (target.checked) {
-      handleFilter(filters);
+      handleFilter({
+        ...filters,
+        [field]: VALUES.FILTER[field]
+      });
     } else {
       handleFilter({
         ...filters,
@@ -246,9 +249,9 @@ const FilterPanel: React.FunctionComponent<{
     handleFilter(_filters)
   }
 
-  const handleFilter = (filters: Filters) => {
-    applyFilters(filters);
-    setFilters(filters)
+  const handleFilter = (_filters: Filters) => {
+    applyFilters(_filters);
+    setFilters(_filters)
   }
 
   return (