From 051b7b22def39dd3f66083362a9cd7833a227a46 Mon Sep 17 00:00:00 2001 From: grittypuffy Date: Fri, 23 Feb 2024 12:38:47 +0530 Subject: [PATCH] Fix: Infinite loading due to empty string in search query --- src/components/NavBar.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue index df3fdaff..73f4f09f 100644 --- a/src/components/NavBar.vue +++ b/src/components/NavBar.vue @@ -200,10 +200,14 @@ export default { }, submitSearch(e) { e.target.blur(); - this.$router.push({ - name: "SearchResults", - query: { search_query: this.searchText }, - }); + if (this.searchText) { + this.$router.push({ + name: "SearchResults", + query: { search_query: this.searchText }, + }); + } else { + this.$router.push("/"); + } return; }, },