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
|
<SelectFilters
|
||||||
filters={filters}
|
filters={filters}
|
||||||
onSelect={(option) => {
|
onSelect={(option) => {
|
||||||
|
const key = option.key as keyof typeof filters;
|
||||||
|
|
||||||
|
const valueExists = filters[key]?.includes(option.value);
|
||||||
|
|
||||||
|
if (valueExists) {
|
||||||
setFilters(
|
setFilters(
|
||||||
{
|
{
|
||||||
...filters,
|
...(filters ?? {}),
|
||||||
[option.key]: [
|
[option.key]: ((filters[key] ?? []) as any[])?.filter(
|
||||||
...((filters?.[option.key as keyof typeof filters] as any[]) ?? []),
|
(val) => val !== option.value
|
||||||
option.value,
|
),
|
||||||
],
|
|
||||||
},
|
},
|
||||||
!Boolean(viewId)
|
!Boolean(viewId)
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
setFilters(
|
||||||
|
{
|
||||||
|
...(filters ?? {}),
|
||||||
|
[option.key]: [...((filters[key] ?? []) as any[]), option.value],
|
||||||
|
},
|
||||||
|
!Boolean(viewId)
|
||||||
|
);
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
direction="left"
|
direction="left"
|
||||||
height="rg"
|
height="rg"
|
||||||
|
Loading…
Reference in New Issue
Block a user