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)