Refactor search component
This commit is contained in:
parent
71b0ee672e
commit
3afad74579
1 changed files with 11 additions and 9 deletions
|
@ -153,13 +153,6 @@ const Search = {
|
|||
'followingOnly' in this.filter && this.filter.followingOnly
|
||||
})
|
||||
|
||||
for (const value of Object.values(data)) {
|
||||
if (value.length) {
|
||||
this.loading = false
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Always append to old results. If new results are empty, this doesn't change anything
|
||||
this.userIds = this.userIds.concat(map(data.accounts, 'id'))
|
||||
this.statuses = uniqBy(this.statuses.concat(data.statuses), 'id')
|
||||
|
@ -182,11 +175,20 @@ const Search = {
|
|||
this.statusesOffset = this.statuses.length
|
||||
// Because the amount of new statuses can actually be zero, compare to old length instead
|
||||
this.lastStatusFetchCount = this.statuses.length - oldStatusesLength
|
||||
}
|
||||
if (searchType === 'media') {
|
||||
} else if (searchType === 'media') {
|
||||
this.mediaOffset = this.media.length
|
||||
this.lastMediaFetchCount = this.media.length - oldMediaLength
|
||||
}
|
||||
|
||||
if (searchTypes.length > 1) {
|
||||
for (const value of Object.values(data)) {
|
||||
if (value.length) {
|
||||
// Show results on the first meaningful response
|
||||
this.loading = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.lastQuery = query
|
||||
|
|
Loading…
Reference in a new issue