Skip to content

Commit

Permalink
Fix results not updating when filters are removed
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <obulat@gmail.com>
  • Loading branch information
obulat committed Mar 8, 2024
1 parent c4be36e commit ca77dc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions frontend/src/pages/search.vue
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/stores/search.ts
Expand Up @@ -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.
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit ca77dc1

Please sign in to comment.