diff --git a/webapp/src/views/HomeView.vue b/webapp/src/views/HomeView.vue index 783dc6c..8f820d4 100644 --- a/webapp/src/views/HomeView.vue +++ b/webapp/src/views/HomeView.vue @@ -2,11 +2,8 @@
- + - - Loading ALPRs... - @@ -120,7 +117,7 @@ const alprs: Ref = ref([]); const clusters: Ref = ref([]); const bboxForLastRequest: Ref = ref(null); const showClusters = computed(() => zoom.value <= CLUSTER_ZOOM_THRESHOLD); -const isLoadingALPRs = computed(() => !showClusters.value && visibleALPRs.value.length === 0); +const isLoadingALPRs = ref(false); const visibleALPRs = computed(() => { return alprs.value.filter(alpr => bounds.value?.containsPoint(alpr.lat, alpr.lon)); @@ -225,6 +222,7 @@ function updateMarkers() { return; } + isLoadingALPRs.value = true; getALPRs(bounds.value) .then((result: any) => { // merge incoming with existing, so that moving the map doesn't remove markers @@ -232,6 +230,9 @@ function updateMarkers() { const newAlprs = result.elements.filter((alpr: any) => !existingIds.has(alpr.id)); alprs.value = [...alprs.value, ...newAlprs]; bboxForLastRequest.value = bounds.value; + }) + .finally(() => { + isLoadingALPRs.value = false; }); }