forked from github/plane
fix: deselecting filter option when clicked again (#528)
* fix: filters dropdown overflowing issue * filters dropdown z-index * fix: deselecting filter option when clicked again --------- Co-authored-by: Aaryan Khandelwal <aaryankhandu123@gmail.com>
This commit is contained in:
parent
f2054b6945
commit
82b9275609
@ -71,16 +71,29 @@ export const IssuesFilterView: React.FC = () => {
|
||||
<SelectFilters
|
||||
filters={filters}
|
||||
onSelect={(option) => {
|
||||
const key = option.key as keyof typeof filters;
|
||||
|
||||
const valueExists = filters[key]?.includes(option.value);
|
||||
|
||||
if (valueExists) {
|
||||
setFilters(
|
||||
{
|
||||
...filters,
|
||||
[option.key]: [
|
||||
...((filters?.[option.key as keyof typeof filters] as any[]) ?? []),
|
||||
option.value,
|
||||
],
|
||||
...(filters ?? {}),
|
||||
[option.key]: ((filters[key] ?? []) as any[])?.filter(
|
||||
(val) => val !== option.value
|
||||
),
|
||||
},
|
||||
!Boolean(viewId)
|
||||
);
|
||||
} else {
|
||||
setFilters(
|
||||
{
|
||||
...(filters ?? {}),
|
||||
[option.key]: [...((filters[key] ?? []) as any[]), option.value],
|
||||
},
|
||||
!Boolean(viewId)
|
||||
);
|
||||
}
|
||||
}}
|
||||
direction="left"
|
||||
height="rg"
|
||||
|
Loading…
Reference in New Issue
Block a user