From 93a30107504f1be71f34dbaead0ac3c80622dfcf Mon Sep 17 00:00:00 2001
From: ManikanthDindigala <dindigala@sub.uni-goettingen.de>
Date: Fri, 13 Aug 2021 11:10:07 +0200
Subject: [PATCH] fix: search result list navigation error

---
 src/.vuepress/components/SearchInput.vue | 13 ++++---------
 src/.vuepress/components/SearchPage.vue  | 13 +++++--------
 2 files changed, 9 insertions(+), 17 deletions(-)

diff --git a/src/.vuepress/components/SearchInput.vue b/src/.vuepress/components/SearchInput.vue
index 0531624..b11e3ad 100644
--- a/src/.vuepress/components/SearchInput.vue
+++ b/src/.vuepress/components/SearchInput.vue
@@ -76,15 +76,10 @@ export default {
       keyboardLayouts: ['arabic', 'syriac']
     }
   },
-  watch:{
-    '$route.query': {
-      handler(query) {
-        if (query.searchTerm) {
-          this.input = query.searchTerm;
-        }
-      },
-      immediate: true,
-    },
+  mounted(){
+    if(this.$route.query?.searchTerm){
+      this.input = this.$route.query.searchTerm;
+    }
   },
   methods: {
     onSubmit(e) {
diff --git a/src/.vuepress/components/SearchPage.vue b/src/.vuepress/components/SearchPage.vue
index 76bc422..4458bbf 100644
--- a/src/.vuepress/components/SearchPage.vue
+++ b/src/.vuepress/components/SearchPage.vue
@@ -64,14 +64,6 @@ export default {
     }
   },
   watch:{
-    '$route.query': {
-      handler(query) {
-        if (query.searchTerm) {
-          this.onSearchInput(query.searchTerm);
-        }
-      },
-      immediate: true,
-    },
     page: function() {
       this.loading = true;
 
@@ -79,6 +71,11 @@ export default {
       this.search(this.query.trim(), from, this.size);
     }
   },
+  mounted(){
+    if(this.$route.query?.searchTerm){
+      this.onSearchInput(this.$route.query.searchTerm);
+    }
+  },
   computed: {
     invalid() {
       return this.query.match(/^\s*$/);
-- 
GitLab