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 <[email protected]>
  • Loading branch information
obulat committed Mar 7, 2024
1 parent 2b77df8 commit 5381bb0
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,6 @@ export const useSearchStore = defineStore("search", {
this.strategy = "default"

this.addRecentSearch(formattedTerm)

const mediaStore = useMediaStore()
mediaStore.clearMedia()
},
/**
* This method need not exist and is only used to fix an odd
Expand Down Expand Up @@ -524,6 +521,9 @@ export const useSearchStore = defineStore("search", {

this.strategy = "default"

const mediaStore = useMediaStore()
mediaStore.clearMedia()

this.setSearchTerm(query.q)
this.searchType = pathToSearchType(path)
if (!isSearchTypeSupported(this.searchType)) {
Expand Down

0 comments on commit 5381bb0

Please sign in to comment.