From ae686bd11425abca8fea1cf2ce5b27191e4a018e Mon Sep 17 00:00:00 2001 From: Brandon Cohen Date: Sun, 21 Apr 2024 18:32:46 -0400 Subject: [PATCH] clean up logic --- src/components/PropertyMap.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/components/PropertyMap.tsx b/src/components/PropertyMap.tsx index 29d6ea4d..8c952d69 100644 --- a/src/components/PropertyMap.tsx +++ b/src/components/PropertyMap.tsx @@ -175,22 +175,20 @@ const PropertyMap: FC = ({ const mapFilter = Object.entries(appFilter).reduce( (acc, [property, filterItem]) => { if (filterItem.values.length) { - const useIndexOfFilterFilter: any = ["any"]; + const thisFilterGroup: any = ["any"]; filterItem.values.forEach((item) => { if (filterItem.useIndexOfFilter) { - useIndexOfFilterFilter.push([ + thisFilterGroup.push([ ">=", ["index-of", item, ["get", property]], 0, ]); } else { - acc.push(["in", ["get", property], item]); + thisFilterGroup.push(["in", ["get", property], item]); } }); - if (filterItem.useIndexOfFilter) { - acc.push(useIndexOfFilterFilter); - } + acc.push(thisFilterGroup); } return acc; },