From 3d78a7377e7aeb7871b11155dca251f8467d1cb0 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Mon, 28 Oct 2024 21:22:56 +0200 Subject: [PATCH] fix states rules not being filtered properly. --- src/components/settings_modal/tabs/style_tab/style_tab.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/settings_modal/tabs/style_tab/style_tab.js b/src/components/settings_modal/tabs/style_tab/style_tab.js index fb5c2e30..2605e8d8 100644 --- a/src/components/settings_modal/tabs/style_tab/style_tab.js +++ b/src/components/settings_modal/tabs/style_tab/style_tab.js @@ -672,8 +672,10 @@ export default { const rule = parentComponentMatch ? r.parent : r if (rule.component !== selectedComponentName.value) return false if (rule.variant !== selectedVariant.value) return false - return r.state.filter(x => x !== 'normal').every(x => selectedState.has(x)) && - [...selectedState.values()].every(x => r.state.indexOf(x) >= 0) + const ruleState = new Set(rule.state.filter(x => x !== 'normal')) + const differenceA = [...ruleState].filter(x => !selectedState.has(x)) + const differenceB = [...selectedState].filter(x => !ruleState.has(x)) + return (differenceA.length + differenceB.length) === 0 }) const sorted = [...filtered] .filter(x => x.component === selectedComponentName.value) @@ -715,7 +717,6 @@ export default { }) const dynamicVars = computed(() => { - console.log('ERR', selectedComponentName.value) return previewRules.value[0].dynamicVars })