Collating album object before sorting, fixes #379

This commit is contained in:
James Barnsley
2019-05-19 11:57:08 +12:00
parent fce4fb6687
commit fea7e55fe0
2 changed files with 8 additions and 3 deletions

View File

@ -37,8 +37,7 @@ class AlbumGrid extends React.Component{
return (
<div className={className}>
{
this.props.albums.map(item => {
var album = helpers.collate(item, {artists: this.props.artists});
this.props.albums.map(album => {
return (
<GridItem
key={album.uri}

View File

@ -147,7 +147,7 @@ class LibraryAlbums extends React.Component{
}
renderView(){
var albums = []
var albums = [];
// Spotify library items
if (this.props.spotify_library_albums && (this.props.source == 'all' || this.props.source == 'spotify')){
@ -197,6 +197,11 @@ class LibraryAlbums extends React.Component{
}
}
// Collate each album into it's full object (including nested artists)
for (let i = 0; i < albums.length; i++) {
albums[i] = helpers.collate(albums[i], {artists: this.props.artists});
}
if (this.props.sort){
albums = helpers.sortItems(albums, this.props.sort, this.props.sort_reverse);
}
@ -355,6 +360,7 @@ const mapStateToProps = (state, ownProps) => {
mopidy_connected: state.mopidy.connected,
mopidy_uri_schemes: state.mopidy.uri_schemes,
load_queue: state.ui.load_queue,
artists: state.core.artists,
albums: state.core.albums,
mopidy_library_albums: state.mopidy.library_albums,
mopidy_library_albums_status: (state.ui.processes.MOPIDY_LIBRARY_ALBUMS_PROCESSOR !== undefined ? state.ui.processes.MOPIDY_LIBRARY_ALBUMS_PROCESSOR.status : null),