From 3db9e99eee2efc8aaa8984148f30350f37e75f3b Mon Sep 17 00:00:00 2001 From: Olga Bulat Date: Thu, 7 Mar 2024 19:11:42 +0300 Subject: [PATCH] Fix results not updating when filters are removed Signed-off-by: Olga Bulat --- frontend/src/pages/search.vue | 3 +++ frontend/src/stores/search.ts | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/pages/search.vue b/frontend/src/pages/search.vue index 5419b1f9722..51672e4b1f1 100644 --- a/frontend/src/pages/search.vue +++ b/frontend/src/pages/search.vue @@ -161,6 +161,9 @@ export default defineComponent({ const { query: urlQuery, path } = newRoute searchStore.setSearchStateFromUrl({ urlQuery, path }) + const mediaStore = useMediaStore() + mediaStore.clearMedia() + /** * By default, Nuxt only scrolls to top when the path changes. * This is a workaround to scroll to top when the query changes. diff --git a/frontend/src/stores/search.ts b/frontend/src/stores/search.ts index 737ed12c9c6..b254a2f29f6 100644 --- a/frontend/src/stores/search.ts +++ b/frontend/src/stores/search.ts @@ -316,9 +316,6 @@ export const useSearchStore = defineStore("search", { this.strategy = "default" this.addRecentSearch(formattedTerm) - - const mediaStore = useMediaStore() - mediaStore.clearMedia() }, /** * Sets the collectionParams and mediaType for the collection page. @@ -348,6 +345,9 @@ export const useSearchStore = defineStore("search", { this.strategy = "default" this.collectionParams = null + const mediaStore = useMediaStore() + mediaStore.clearMedia() + this.setSearchTerm(query.q) this.searchType = pathToSearchType(path)