forked from github/plane
chore: filter empty state handling in issue filter selection
This commit is contained in:
parent
3c9e62d308
commit
fce6907465
@ -33,12 +33,13 @@ export const FilterAssignees = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
@ -16,12 +16,13 @@ export const FilterCreatedBy = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
@ -21,12 +21,13 @@ export const FilterLabels = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
@ -57,12 +57,13 @@ export const FilterPriority = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
@ -88,12 +88,13 @@ export const FilterStateGroup = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
@ -18,12 +18,13 @@ export const FilterState = observer(() => {
|
||||
const [previewEnabled, setPreviewEnabled] = React.useState(true);
|
||||
|
||||
const handleFilter = (key: string, value: string) => {
|
||||
const _value =
|
||||
let _value =
|
||||
issueFilterStore?.userFilters?.filters?.[key] != null
|
||||
? issueFilterStore?.userFilters?.filters?.[key].includes(value)
|
||||
? issueFilterStore?.userFilters?.filters?.[key].filter((p: string) => p != value)
|
||||
: [...issueFilterStore?.userFilters?.filters?.[key], value]
|
||||
: [value];
|
||||
_value = _value && _value.length > 0 ? _value : null;
|
||||
issueFilterStore.handleUserFilter("filters", key, _value);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user