Skip to content

Commit

Permalink
fix: clear filter name when the list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY committed Jul 15, 2024
1 parent 034040e commit e266fa9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/MultiFilterButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ export function MultiFilterButton({
}

const newSearch = new URLSearchParams(search)
newSearch.append(filterName, Array.from(subTypes).join(','))
if (subTypes.size === 0) {
newSearch.delete(filterName)
} else {
newSearch.append(filterName, Array.from(subTypes).join(','))
}
return `${f.to}?${newSearch.toString()}`
}}
data-is-active={types.includes(f.value)}
Expand Down

0 comments on commit e266fa9

Please sign in to comment.