mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 05:29:41 +00:00
Reset filters and search when switching libraries
This commit is contained in:
parent
f7506e84d3
commit
8f189763f0
5 changed files with 47 additions and 3 deletions
|
|
@ -128,6 +128,13 @@ export default {
|
|||
return this.bookResults.length + this.seriesResults.length + this.authorResults.length + this.tagResults.length + this.genreResults.length + this.podcastResults.length + this.narratorResults.length + this.episodeResults.length
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
currentLibraryId(newVal, oldVal) {
|
||||
if (newVal && oldVal && newVal !== oldVal) {
|
||||
this.clearResults()
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
clickOption() {
|
||||
this.clearResults()
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export default {
|
|||
// For series item page redirect to root series page
|
||||
this.$router.push(`/library/${library.id}/bookshelf/series`)
|
||||
} else if (this.$route.name === 'library-library-search') {
|
||||
this.$router.push(this.$route.fullPath.replace(currLibraryId, library.id))
|
||||
this.$router.push(`/library/${library.id}/bookshelf`)
|
||||
} else if (this.$route.name.startsWith('library')) {
|
||||
this.$router.push(this.$route.path.replace(currLibraryId, library.id))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export const actions = {
|
|||
const issues = data.issues || 0
|
||||
const numUserPlaylists = data.numUserPlaylists
|
||||
|
||||
dispatch('user/checkUpdateLibrarySortFilter', library.mediaType, { root: true })
|
||||
dispatch('user/checkUpdateLibrarySortFilter', { mediaType: library.mediaType, libraryChanging }, { root: true })
|
||||
|
||||
if (libraryChanging) {
|
||||
commit('setCollections', [])
|
||||
|
|
|
|||
|
|
@ -83,8 +83,14 @@ export const getters = {
|
|||
|
||||
export const actions = {
|
||||
// When changing libraries make sure sort and filter is still valid
|
||||
checkUpdateLibrarySortFilter({ state, dispatch, commit }, mediaType) {
|
||||
checkUpdateLibrarySortFilter({ state, dispatch, commit }, { mediaType, libraryChanging }) {
|
||||
const settingsUpdate = {}
|
||||
|
||||
if (libraryChanging) {
|
||||
settingsUpdate.filterBy = 'all'
|
||||
settingsUpdate.seriesFilterBy = 'all'
|
||||
}
|
||||
|
||||
if (mediaType == 'podcast') {
|
||||
if (state.settings.orderBy == 'media.metadata.authorName' || state.settings.orderBy == 'media.metadata.authorNameLF') {
|
||||
settingsUpdate.orderBy = 'media.metadata.author'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue