From 5c9ad3068bb286139bc6bc38b16b2736e6bb4ce0 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 8 Jul 2022 13:55:27 -0700 Subject: [PATCH] simplify filter rule comparison --- src-ui/src/app/data/filter-rule.ts | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src-ui/src/app/data/filter-rule.ts b/src-ui/src/app/data/filter-rule.ts index 4460d39ab..b0b9cb415 100644 --- a/src-ui/src/app/data/filter-rule.ts +++ b/src-ui/src/app/data/filter-rule.ts @@ -29,28 +29,19 @@ export function filterRulesDiffer( filterRulesA: FilterRule[], filterRulesB: FilterRule[] ): boolean { - let modified = false + let differ = false if (filterRulesA.length != filterRulesB.length) { - modified = true + differ = true } else { - modified = filterRulesA.some((rule) => { + differ = filterRulesA.some((rule) => { return ( filterRulesB.find( (fri) => fri.rule_type == rule.rule_type && fri.value == rule.value ) == undefined ) }) - - if (!modified) { - // only check other direction if we havent already determined is modified - modified = filterRulesB.some((rule) => { - filterRulesA.find( - (fr) => fr.rule_type == rule.rule_type && fr.value == rule.value - ) == undefined - }) - } } - return modified + return differ } export interface FilterRule {