From 13f33b8393d57c4978b64c45b0c271bf7da17e0f Mon Sep 17 00:00:00 2001 From: setop Date: Fri, 5 Mar 2021 16:19:42 +0000 Subject: [PATCH] make search with location bookmarkable (fix #482) using geohash set a default radius when a location is set, so it does not trigger a worldwide search reduce pressure on server and view with debonce --- .../components/Event/AddressAutoComplete.vue | 15 ++- js/src/views/Admin/Settings.vue | 2 +- js/src/views/Search.vue | 119 +++++++++++++++--- 3 files changed, 115 insertions(+), 21 deletions(-) diff --git a/js/src/components/Event/AddressAutoComplete.vue b/js/src/components/Event/AddressAutoComplete.vue index 407c991f7..9be4b29aa 100644 --- a/js/src/components/Event/AddressAutoComplete.vue +++ b/js/src/components/Event/AddressAutoComplete.vue @@ -81,7 +81,7 @@ export default class AddressAutoComplete extends Vue { isFetching = false; - queryText: string = (this.value && new Address(this.value).fullName) || ""; + initialQueryText = ""; addressModalActive = false; @@ -149,12 +149,21 @@ export default class AddressAutoComplete extends Vue { } } + get queryText(): string { + if (this.value) { + return new Address(this.value).fullName; + } + return this.initialQueryText; + } + + set queryText(queryText: string) { + this.initialQueryText = queryText; + } + @Watch("value") updateEditing(): void { if (!this.value?.id) return; this.selected = this.value; - const address = new Address(this.selected); - this.queryText = `${address.poiInfos.name} ${address.poiInfos.alternativeName}`; } updateSelected(option: IAddress): void { diff --git a/js/src/views/Admin/Settings.vue b/js/src/views/Admin/Settings.vue index 2c4a05444..10214a49c 100644 --- a/js/src/views/Admin/Settings.vue +++ b/js/src/views/Admin/Settings.vue @@ -332,7 +332,7 @@