From f75fc5043652badb49eaabb68e345e2822d21208 Mon Sep 17 00:00:00 2001 From: In3luki <41452412+In3luki@users.noreply.github.com> Date: Fri, 27 Dec 2024 15:50:40 +0100 Subject: [PATCH] Tighten logic for compendium browser trait filtering (#17841) --- .../apps/compendium-browser/tabs/base.svelte.ts | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/module/apps/compendium-browser/tabs/base.svelte.ts b/src/module/apps/compendium-browser/tabs/base.svelte.ts index 3314fb8ef2d..eeee06ff454 100644 --- a/src/module/apps/compendium-browser/tabs/base.svelte.ts +++ b/src/module/apps/compendium-browser/tabs/base.svelte.ts @@ -150,15 +150,13 @@ export abstract class CompendiumBrowserTab { ): boolean { const selectedTraits = selected.filter((s) => !s.not).map((s) => s.value); const notTraits = selected.filter((t) => t.not).map((s) => s.value); - if (selectedTraits.length || notTraits.length) { - if (notTraits.some((t) => traits.includes(t))) { - return false; - } - const fullfilled = - condition === "and" - ? selectedTraits.every((t) => traits.includes(t)) - : selectedTraits.some((t) => traits.includes(t)); - if (!fullfilled) return false; + if (notTraits.some((t) => traits.includes(t))) { + return false; + } + if (selectedTraits.length) { + return condition === "and" + ? selectedTraits.every((t) => traits.includes(t)) + : selectedTraits.some((t) => traits.includes(t)); } return true; }