Optimize song filterings

This commit is contained in:
An Phan 2016-06-27 00:56:55 +08:00
parent 06303c4852
commit 5f9cb7a796
No known key found for this signature in database
GPG key ID: 05536BB4BCDC02A2

View file

@ -72,6 +72,7 @@ export default {
sortingByAlbum: false,
sortingByArtist: false,
selectedSongs: [],
mutatedItems: [],
};
},
@ -84,6 +85,8 @@ export default {
this.sortKey = '';
}
this.mutatedItems = this.items;
// Update the song count and duration status on parent.
this.$parent.updateMeta({
songCount: this.items.length,
@ -100,7 +103,7 @@ export default {
displayedItems() {
return limitBy(
filterBy(
orderBy(this.items, this.sortKey, this.order),
this.mutatedItems,
this.q,
'title', 'album.name', 'artist.name'
),
@ -124,6 +127,7 @@ export default {
this.order = 0 - this.order;
this.sortingByAlbum = Array.isArray(this.sortKey) && this.sortKey[0] === 'album.name';
this.sortingByArtist = Array.isArray(this.sortKey) && this.sortKey[0] === 'album.artist.name';
this.mutatedItems = orderBy(this.items, this.sortKey, this.order);
},
/**