From 606d9ec7343f20b2e919c93f703ce32a0c0b898b Mon Sep 17 00:00:00 2001 From: Trent Larson Date: Thu, 30 Nov 2023 20:30:00 -0700 Subject: [PATCH] fix the result count when the search filters change --- src/views/DiscoverView.vue | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/views/DiscoverView.vue b/src/views/DiscoverView.vue index 5735017..c770440 100644 --- a/src/views/DiscoverView.vue +++ b/src/views/DiscoverView.vue @@ -41,8 +41,10 @@ Nearby {{ localCount > -1 ? localCount : "?" }} + {{ localCount > -1 ? localCount : "?" }} +
  • @@ -59,8 +61,10 @@ Anywhere {{ remoteCount > -1 ? remoteCount : "?" }} + {{ remoteCount > -1 ? remoteCount : "?" }} +
  • @@ -156,12 +160,12 @@ export default class DiscoverView extends Vue { apiServer = ""; searchTerms = ""; projects: ProjectData[] = []; + isLoading = false; isLocalActive = true; isRemoteActive = false; localCount = -1; remoteCount = -1; searchBox: { name: string; bbox: BoundingBox } | null = null; - isLoading = false; // make this function available to the Vue template didInfo = didInfo; @@ -188,6 +192,11 @@ export default class DiscoverView extends Vue { } } + public resetCounts() { + this.localCount = -1; + this.remoteCount = -1; + } + public async searchSelected() { if (this.isLocalActive) { await this.searchLocal(); @@ -221,6 +230,8 @@ export default class DiscoverView extends Vue { } public async searchAll(beforeId?: string) { + this.resetCounts(); + if (!beforeId) { // this was an initial search so clear any previous results this.projects = []; @@ -288,6 +299,8 @@ export default class DiscoverView extends Vue { } public async searchLocal(beforeId?: string) { + this.resetCounts(); + if (!this.searchBox) { this.projects = []; return;