Compare commits

...

2 Commits

Author SHA1 Message Date
itepechi 3afad74579 Refactor search component 2023-11-06 07:44:00 +09:00
itepechi 71b0ee672e Remove the loading state as soon as possible
i meant false, not true
2023-11-06 07:33:18 +09:00
1 changed files with 11 additions and 9 deletions

View File

@ -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 = true
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