mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 23:25:56 -05:00
[web-src] recently added - optimise fetch of 'older' albums in mounted() when mixin async data known
This commit is contained in:
parent
52d765900c
commit
b985634924
@ -110,11 +110,6 @@ const browseData = {
|
||||
type: 'album',
|
||||
expression: 'time_added after last month and media_kind is music order by time_added desc',
|
||||
limit: recentlyAddedLimit
|
||||
}),
|
||||
webapi.search({
|
||||
type: 'album',
|
||||
expression: 'time_added before last month and media_kind is music order by time_added desc',
|
||||
limit: recentlyAddedLimit
|
||||
})
|
||||
])
|
||||
},
|
||||
@ -123,13 +118,6 @@ const browseData = {
|
||||
vm.recently_added_today = response[0].data.albums
|
||||
vm.recently_added_week = response[1].data.albums
|
||||
vm.recently_added_month = response[2].data.albums
|
||||
vm.recently_added_older = response[3].data.albums
|
||||
|
||||
if (vm.recently_added_older.items.length) {
|
||||
const keep = vm.recently_added_older.items.length - store.getters.settings_option_recently_added_limit - vm.recently_added_month.items.length
|
||||
vm.recently_added_older.items.splice(keep)
|
||||
vm.recently_added_older.total = keep
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,6 +140,19 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
mounted () {
|
||||
const more = store.getters.settings_option_recently_added_limit - this.recently_added_month.items.length
|
||||
if (more) {
|
||||
webapi.search({
|
||||
type: 'album',
|
||||
expression: 'time_added before last month and media_kind is music order by time_added desc',
|
||||
limit: more
|
||||
}).then(({ data }) => {
|
||||
this.recently_added_older = data.albums
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
show_recent_today () {
|
||||
return this.recently_added_today.items.length > 0
|
||||
|
Loading…
Reference in New Issue
Block a user