diff --git a/src/components/common/VnSelect.vue b/src/components/common/VnSelect.vue index 88a9d387d..0f411f985 100644 --- a/src/components/common/VnSelect.vue +++ b/src/components/common/VnSelect.vue @@ -152,6 +152,16 @@ const value = computed({ }, }); +const arrayDataKey = + $props.dataKey ?? + ($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label)); + +const arrayData = useArrayData(arrayDataKey, { + url: $props.url, + searchUrl: false, + mapKey: $attrs['map-key'], +}); + const computedSortBy = computed(() => { return $props.sortBy || $props.optionLabel + ' ASC'; }); @@ -176,16 +186,7 @@ onMounted(() => { if ($props.focusOnMount) setTimeout(() => vnSelectRef.value.showPopup(), 300); }); -const arrayDataKey = - $props.dataKey ?? - ($props.url?.length > 0 ? $props.url : ($attrs.name ?? $attrs.label)); - -const arrayData = useArrayData(arrayDataKey, { - url: $props.url, - searchUrl: false, - mapKey: $attrs['map-key'], -}); -const someIsLoading = computed(() => isLoading.value || arrayData.isLoading); +const someIsLoading = computed(() => isLoading.value || arrayData?.isLoading?.value); function findKeyInOptions() { if (!$props.options) return; return filter($props.modelValue, $props.options)?.length;