Skip to content

Commit

Permalink
[Fix] polygon filter reload (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorDykhta committed Sep 12, 2022
1 parent ea73859 commit 8878cff
Show file tree
Hide file tree
Showing 3 changed files with 2,574 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/table/src/filter-utils.ts
Expand Up @@ -603,9 +603,14 @@ export function diffFilters(
*
* @returns value - adjusted value to match filter or null to remove filter
*/
/* eslint-disable complexity */
// eslint-disable-next-line complexity
export function adjustValueToFilterDomain(value: Filter['value'], {domain, type}) {
if (!domain || !type) {
if (!type) {
return false;
}
// if the current filter is a polygon it will not have any domain
// all other filter types require domain
if (type !== FILTER_TYPES.polygon && !domain) {
return false;
}

Expand All @@ -627,6 +632,8 @@ export function adjustValueToFilterDomain(value: Filter['value'], {domain, type}

case FILTER_TYPES.select:
return domain.includes(value) ? value : true;
case FILTER_TYPES.polygon:
return value;

default:
return null;
Expand Down Expand Up @@ -810,7 +817,7 @@ export function isFilterValidToSave(filter: any): boolean {
return (
filter?.type &&
Array.isArray(filter?.name) &&
filter?.name.length &&
(filter?.name.length || filter?.layerId.length) &&
isValidFilterValue(filter?.type, filter?.value)
);
}
Expand Down

0 comments on commit 8878cff

Please sign in to comment.