From 640f00f16d16eb686f0f4b6fc8268690b38d7c90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ciar=C3=A1n=20Ainsworth?= <cda@rootkey.co.uk>
Date: Mon, 27 Jul 2020 11:03:47 +0200
Subject: [PATCH] Fix issue with album and artist search page

---
 changes/changelog.d/search-page.bugfix   | 1 +
 front/src/components/library/Albums.vue  | 5 ++++-
 front/src/components/library/Artists.vue | 5 ++++-
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 changes/changelog.d/search-page.bugfix

diff --git a/changes/changelog.d/search-page.bugfix b/changes/changelog.d/search-page.bugfix
new file mode 100644
index 0000000000..eb9bc69ddc
--- /dev/null
+++ b/changes/changelog.d/search-page.bugfix
@@ -0,0 +1 @@
+Fixed an issue with search pages where results would not appear after navigating to another page
\ No newline at end of file
diff --git a/front/src/components/library/Albums.vue b/front/src/components/library/Albums.vue
index 647e37b475..4f9bcd8b2b 100644
--- a/front/src/components/library/Albums.vue
+++ b/front/src/components/library/Albums.vue
@@ -4,7 +4,7 @@
       <h2 class="ui header">
         <translate translate-context="Content/Album/Title">Browsing albums</translate>
       </h2>
-      <form :class="['ui', {'loading': isLoading}, 'form']" @submit.prevent="updateQueryString();fetchData()">
+      <form :class="['ui', {'loading': isLoading}, 'form']" @submit.prevent="updatePage();updateQueryString();fetchData()">
         <div class="fields">
           <div class="field">
             <label>
@@ -195,6 +195,9 @@ export default {
     },
     selectPage: function(page) {
       this.page = page
+    },
+    updatePage() {
+      this.page = this.defaultPage
     }
   },
   watch: {
diff --git a/front/src/components/library/Artists.vue b/front/src/components/library/Artists.vue
index 98d06e7763..f42daa9dca 100644
--- a/front/src/components/library/Artists.vue
+++ b/front/src/components/library/Artists.vue
@@ -4,7 +4,7 @@
       <h2 class="ui header">
         <translate translate-context="Content/Artist/Title">Browsing artists</translate>
       </h2>
-      <form :class="['ui', {'loading': isLoading}, 'form']" @submit.prevent="updateQueryString();fetchData()">
+      <form :class="['ui', {'loading': isLoading}, 'form']" @submit.prevent="updatePage();updateQueryString();fetchData()">
         <div class="fields">
           <div class="field">
             <label>
@@ -186,6 +186,9 @@ export default {
     },
     selectPage: function(page) {
       this.page = page
+    },
+    updatePage() {
+      this.page = this.defaultPage
     }
   },
   watch: {
-- 
GitLab