You've already forked AstralRinth
forked from didirus/AstralRinth
Fix search always resetting back to page 1
This commit is contained in:
@@ -162,6 +162,8 @@ const {
|
|||||||
createPageParams,
|
createPageParams,
|
||||||
} = useSearch(projectTypes, tags, instanceFilters)
|
} = useSearch(projectTypes, tags, instanceFilters)
|
||||||
|
|
||||||
|
const previousFilterState = ref('')
|
||||||
|
|
||||||
const offline = ref(!navigator.onLine)
|
const offline = ref(!navigator.onLine)
|
||||||
window.addEventListener('offline', () => {
|
window.addEventListener('offline', () => {
|
||||||
offline.value = true
|
offline.value = true
|
||||||
@@ -221,8 +223,21 @@ async function refreshSearch() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
results.value = rawResults.result
|
results.value = rawResults.result
|
||||||
currentPage.value = 1
|
|
||||||
|
const currentFilterState = JSON.stringify({
|
||||||
|
query: query.value,
|
||||||
|
filters: currentFilters.value,
|
||||||
|
sort: currentSortType.value,
|
||||||
|
maxResults: maxResults.value,
|
||||||
|
projectTypes: projectTypes.value
|
||||||
|
})
|
||||||
|
|
||||||
|
if (previousFilterState.value && previousFilterState.value !== currentFilterState) {
|
||||||
|
currentPage.value = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
previousFilterState.value = currentFilterState
|
||||||
|
|
||||||
const persistentParams: LocationQuery = {}
|
const persistentParams: LocationQuery = {}
|
||||||
|
|
||||||
@@ -382,6 +397,15 @@ const handleOptionsClick = (args) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await refreshSearch()
|
await refreshSearch()
|
||||||
|
|
||||||
|
// Initialize previousFilterState after first search
|
||||||
|
previousFilterState.value = JSON.stringify({
|
||||||
|
query: query.value,
|
||||||
|
filters: currentFilters.value,
|
||||||
|
sort: currentSortType.value,
|
||||||
|
maxResults: maxResults.value,
|
||||||
|
projectTypes: projectTypes.value
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
Reference in New Issue
Block a user