Use Set with .has() instead of Array with .includes() (S7776)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -209,7 +209,7 @@
|
||||
</div>
|
||||
<!-- type: value -->
|
||||
<div
|
||||
v-else-if="valueTypes.includes(selectedAttName.type)"
|
||||
v-else-if="valueTypes.has(selectedAttName.type)"
|
||||
class="space-y-2 text-sm w-full"
|
||||
>
|
||||
<!-- Chart.js -->
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user