Skip to content
Snippets Groups Projects
Verified Commit 35ef9604 authored by Yoran Hillion's avatar Yoran Hillion
Browse files

:bug: Reset search aggregations, buckets and pagination at toSearch change

parent 0dfd7c87
Branches
Tags v3-sr15
No related merge requests found
Pipeline #140320 failed with stages
in 10 seconds
......@@ -77,6 +77,9 @@ export const useSearchStore = defineStore('Search', {
resetAggregations() {
this.aggregations = {}
},
resetBuckets() {
this.buckets = {}
},
async loadAuthResults(query?: string) {
const { results, aggregations, hits } = await getAuthSearchResults(query || this.query)
this.results = results.map((result) => {
......
......@@ -23,18 +23,21 @@ params.value = {
}
const loadResults = async () => {
searchStore.resetPagination()
searchStore.resetAggregations()
searchStore.resetBuckets()
searchStore.loadAuthResults()
}
watch(locale, () => {
searchStore.resetPagination()
searchStore.resetAggregations()
loadResults()
searchStore.loadAuthResults()
})
const aggregationsValue = computed(() => getAggregations.value())
watch(aggregationsValue, () => {
searchStore.resetPagination()
loadResults()
searchStore.loadAuthResults()
})
const page = computed({
......@@ -45,7 +48,9 @@ const page = computed({
pagination.value.page = newValue
}
})
watch(page, loadResults)
watch(page, () => {
searchStore.loadAuthResults()
})
const pageSize = computed(() => pagination.value.pageSize)
onUnmounted(() => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment