Reload search page if searching again and already in search tab
This commit is contained in:
parent
c1198037a8
commit
aaecaab04d
File diff suppressed because one or more lines are too long
@ -156,6 +156,7 @@ export default {
|
||||
mounted() {
|
||||
EventBus.$on('mainSearch:checkLoadMoreContent', this.checkLoadMoreContent)
|
||||
this.$root.$on('mainSearch:showNewResults', this.checkIfShowNewResults)
|
||||
this.$root.$on('mainSearch:updateResults', this.checkIfUpdateResults)
|
||||
|
||||
socket.on('mainSearch', this.handleMainSearch)
|
||||
socket.on('search', this.handleSearch)
|
||||
@ -186,6 +187,15 @@ export default {
|
||||
this.showNewResults(term)
|
||||
}
|
||||
},
|
||||
checkIfUpdateResults(term, mainSelected) {
|
||||
let needToUpdateSearch = term === this.results.query && this.currentTab.searchType !== 'all'
|
||||
|
||||
if (needToUpdateSearch) {
|
||||
let resetObj = { data: [], next: 0, total: 0, loaded: false }
|
||||
this.results[this.currentTab.searchType+"Tab"] = { ...resetObj }
|
||||
this.search(this.currentTab.searchType)
|
||||
}
|
||||
},
|
||||
showNewResults(term) {
|
||||
socket.emit('mainSearch', { term })
|
||||
|
||||
|
@ -75,7 +75,10 @@ export default {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (isShowingSearch && sameAsLastSearch) return
|
||||
if (isShowingSearch && sameAsLastSearch){
|
||||
this.$root.$emit('mainSearch:updateResults', term, window.main_selected)
|
||||
return
|
||||
}
|
||||
|
||||
if (!isShowingSearch) {
|
||||
await this.$router.push({
|
||||
|
Loading…
Reference in New Issue
Block a user