From 4e5129ca137ad1431538393689ced0e8ce54de22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Tue, 10 Mar 2026 00:32:30 +0800 Subject: [PATCH] Use Set with .has() instead of Array with .includes() (S7776) Co-Authored-By: Claude Opus 4.6 --- .../Discover/Map/Filter/AttributesFilter.vue | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/Discover/Map/Filter/AttributesFilter.vue b/src/components/Discover/Map/Filter/AttributesFilter.vue index b250808..ad8eee0 100644 --- a/src/components/Discover/Map/Filter/AttributesFilter.vue +++ b/src/components/Discover/Map/Filter/AttributesFilter.vue @@ -209,7 +209,7 @@
@@ -335,8 +335,8 @@ const { filterAttrs } = storeToRefs(allMapDataStore); const selectedAttName = ref({}); const selectedAttRange = ref(null); -const valueTypes = ["int", "float", "date"]; -const classTypes = ["boolean", "string"]; +const valueTypes = new Set(["int", "float", "date"]); +const classTypes = new Set(["boolean", "string"]); const chartData = ref({}); const chartOptions = ref({}); const chartComplete = ref(null); // Rendered chart.js instance data @@ -384,7 +384,7 @@ const attRangeTotal = computed(() => { let result = null; // Initialize the result variable with null - if (classTypes.includes(type) && attRangeData.value) { + if (classTypes.has(type) && attRangeData.value) { result = `(${attRangeData.value.length})`; // Assign the length of attRangeData if it exists } return result; @@ -422,7 +422,7 @@ const attRangeData = computed(() => { // Get the selected Attribute radio's numeric-type data const valueData = computed(() => { // filter returns an array, find returns the first matched element, so use find here. - if (valueTypes.includes(selectedAttName.value.type)) { + if (valueTypes.has(selectedAttName.value.type)) { const data = filterAttrs.value.find( (item) => item.type === selectedAttName.value.type && @@ -945,7 +945,7 @@ function sliderValueRange(e, direction) { emitter.on("map-filter-reset", (value) => { if (value) { selectedAttRange.value = null; - if (valueData.value && valueTypes.includes(selectedAttName.value.type)) { + if (valueData.value && valueTypes.has(selectedAttName.value.type)) { const min = valueData.value.min; const max = valueData.value.max; startTime.value = new Date(min);