From 2b4d2572b3c1d4a0584a89301c1e787d7fa43f3a Mon Sep 17 00:00:00 2001 From: "andrii.dudar" Date: Thu, 19 Sep 2024 16:07:36 +0200 Subject: [PATCH] [OPIK-129] [UX Improvements] Show filter item by default when clicking on Filters (#288) --- .../src/components/shared/FiltersButton/FiltersButton.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/opik-frontend/src/components/shared/FiltersButton/FiltersButton.tsx b/apps/opik-frontend/src/components/shared/FiltersButton/FiltersButton.tsx index a581fd9c05..3f8488e212 100644 --- a/apps/opik-frontend/src/components/shared/FiltersButton/FiltersButton.tsx +++ b/apps/opik-frontend/src/components/shared/FiltersButton/FiltersButton.tsx @@ -34,7 +34,11 @@ const FiltersButton = ({ useEffect(() => { if (!open) { - setFilters(initialFilters); + if (initialFilters.length === 0) { + setFilters([createEmptyFilter()]); + } else { + setFilters(initialFilters); + } } }, [initialFilters, open]);