Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit a040b89

Browse files
committed
changes for #141
1 parent f450db4 commit a040b89

File tree

1 file changed

+10
-5
lines changed
  • client/src/components/editFiltersPopup

1 file changed

+10
-5
lines changed

client/src/components/editFiltersPopup/index.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function EditFiltersPopup({ onCancel, onDone }) {
5252
);
5353
const [filterGroups, setFilterGroups] = useState(initialFilters);
5454
const [selectedFilters, setSelectedFilters] = useState(initialSelection);
55-
const [sections, setSections] = useState(initialSections, initialSections);
55+
const [sections, setSections] = useState(initialSections);
5656

5757
const handleCancel = () => {
5858
if (onCancel) {
@@ -90,10 +90,15 @@ export default function EditFiltersPopup({ onCancel, onDone }) {
9090

9191
const handleSearch = (q) => {
9292
if (q.length === 0) {
93-
setFilterGroups(initialFilters);
93+
const [filteredSections, filteredGroups] = getInitialFilters(
94+
searchFilters,
95+
() => true
96+
);
97+
setSections(filteredSections);
98+
setFilterGroups(filteredGroups);
9499
} else if (q.length >= 3) {
95100
const [filteredSections, filteredGroups] = getInitialFilters(
96-
{ ...search.filters },
101+
searchFilters,
97102
(f) => {
98103
return f.text.toLowerCase().includes(q.toLowerCase());
99104
}
@@ -201,10 +206,10 @@ function PopupSection({ title, filters, onFilterValueChange }) {
201206
<>
202207
<PopupSectionTitle text={title} />
203208
<div className={styles.popupSectionBody}>
204-
{filters.map((filter, index) => {
209+
{filters.map((filter) => {
205210
return (
206211
<PopupSectionRow
207-
key={index}
212+
key={filter.id}
208213
text={filter.name}
209214
filterActivated={filter.isActive}
210215
id={filter.id}

0 commit comments

Comments
 (0)