From b77d3f8aa4bfea6f62fc597adf4f36ef13d7e002 Mon Sep 17 00:00:00 2001
From: Terry Truong <terry06890@gmail.com>
Date: Thu, 23 Jun 2022 22:45:05 +1000
Subject: Fix error upon empty-string search

---
 src/components/SearchModal.vue | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/components/SearchModal.vue')

diff --git a/src/components/SearchModal.vue b/src/components/SearchModal.vue
index bb58cbb..d2aa383 100644
--- a/src/components/SearchModal.vue
+++ b/src/components/SearchModal.vue
@@ -57,7 +57,7 @@ export default defineComponent({
 	},
 	methods: {
 		onCloseClick(evt: Event){
-			if (evt.target == this.$el || (this.$refs.searchIcon as typeof SearchIcon).$el.contains(evt.target)){
+			if (evt.target == this.$el){
 				this.$emit('close');
 			}
 		},
@@ -70,6 +70,9 @@ export default defineComponent({
 			}
 		},
 		resolveSearch(tolNodeName: string){
+			if (tolNodeName == ''){
+				return;
+			}
 			// Asks server for nodes in parent-chain, updates tolMap, then emits search event
 			let url = new URL(window.location.href);
 			url.pathname = '/data/chain';
@@ -210,7 +213,7 @@ export default defineComponent({
 				<div v-if="searchHasMoreSuggs" class="bg-white px-1 text-center border">...</div>
 			</div>
 		</div>
-		<search-icon @click.stop="onEnter" ref="searchIcon"
+		<search-icon @click.stop="onEnter"
 			class="block w-8 h-8 ml-1 hover:cursor-pointer hover:bg-stone-200" />
 	</div>
 </div>
-- 
cgit v1.2.3

