From f51e83099ecaa9c91b9438434fc4b0c2366974d3 Mon Sep 17 00:00:00 2001 From: James Barnsley Date: Tue, 15 Aug 2017 16:36:50 +1200 Subject: [PATCH] Processor cancelled vs finished; Re-run processor if incomplete during next render --- src/js/services/core/reducer.js | 75 ------------------------ src/js/services/mopidy/middleware.js | 10 +++- src/js/services/mopidy/reducer.js | 29 +++++++++ src/js/services/spotify/actions.js | 13 ++-- src/js/services/spotify/reducer.js | 60 +++++++++++++++++++ src/js/services/ui/actions.js | 7 +++ src/js/services/ui/middleware.js | 11 +++- src/js/services/ui/reducer.js | 1 + src/js/views/Album.js | 6 +- src/js/views/Artist.js | 6 +- src/js/views/Playlist.js | 14 +++-- src/js/views/library/LibraryAlbums.js | 12 ++-- src/js/views/library/LibraryArtists.js | 12 ++-- src/js/views/library/LibraryPlaylists.js | 6 +- 14 files changed, 156 insertions(+), 106 deletions(-) diff --git a/src/js/services/core/reducer.js b/src/js/services/core/reducer.js index b8a5caf0..73f32d1a 100755 --- a/src/js/services/core/reducer.js +++ b/src/js/services/core/reducer.js @@ -200,36 +200,6 @@ export default function reducer(core = {}, action){ return Object.assign({}, core, { albums: albums }); - case 'LIBRARY_ALBUMS_LOADED': - var library_albums = [] - if (core.library_albums) library_albums = Object.assign([], core.library_albums) - - return Object.assign({}, core, { - library_albums: helpers.removeDuplicates([...library_albums, ...action.uris]), - library_albums_more: (action.more ? action.more : null), - library_albums_total: (action.total ? action.total : null), - library_albums_started: (action.started ? action.started : null), - }); - - case 'ALBUM_LIBRARY_CHECK': - var items = Object.assign([], core.library_albums) - - // add/remove library reference - var index = items.indexOf(action.key) - - // removing existing - if (index > -1 && !action.in_library){ - items.splice(index, 1) - } else if (index < 0 && action.in_library){ - items.push(action.key) - } - - return Object.assign({}, core, { library_albums: items }); - - case 'LOCAL_ALBUMS_LOADED': - if (!action.uris) return Object.assign({}, core, { local_albums: null }); - return Object.assign({}, core, { local_albums: action.uris }); - case 'NEW_RELEASES_LOADED': if (!action.uris){ return Object.assign({}, core, { @@ -304,36 +274,6 @@ export default function reducer(core = {}, action){ artists[action.key] = artist return Object.assign({}, core, { artists: artists }); - case 'LIBRARY_ARTISTS_LOADED': - var library_artists = [] - if (core.library_artists) library_artists = Object.assign([], core.library_artists) - - return Object.assign({}, core, { - library_artists: helpers.removeDuplicates([...library_artists, ...action.uris]), - library_artists_more: action.more, - library_artists_total: action.total, - library_artists_started: true - }); - - case 'ARTIST_LIBRARY_CHECK': - var items = Object.assign([], core.library_artists) - - // add/remove library reference - var index = items.indexOf(action.key) - - // removing existing - if (index > -1 && !action.in_library){ - items.splice(index, 1) - } else if (index < 0 && action.in_library){ - items.push(action.key) - } - - return Object.assign({}, core, { library_artists: items }); - - case 'LOCAL_ARTISTS_LOADED': - if (!action.uris) return Object.assign({}, core, { local_artists: null }); - return Object.assign({}, core, { local_artists: action.uris }); - /** * User profiles @@ -532,21 +472,6 @@ export default function reducer(core = {}, action){ library_playlists_started: true }); - case 'PLAYLIST_LIBRARY_CHECK': - var items = Object.assign([], core.library_playlists) - - // add/remove library reference - var index = items.indexOf(action.key) - - // removing existing - if (index > -1 && !action.in_library){ - items.splice(index, 1) - } else if (index < 0 && action.in_library){ - items.push(action.key) - } - - return Object.assign({}, core, { library_playlists: items }); - /** * Genres diff --git a/src/js/services/mopidy/middleware.js b/src/js/services/mopidy/middleware.js index 7e3f068f..ac635057 100755 --- a/src/js/services/mopidy/middleware.js +++ b/src/js/services/mopidy/middleware.js @@ -852,6 +852,9 @@ const MopidyMiddleware = (function(){ **/ case 'MOPIDY_GET_LIBRARY_ALBUMS': + + store.dispatch({type: 'MOPIDY_LIBRARY_ALBUMS_CLEAR'}) + instruct( socket, store, 'library.browse', { uri: 'local:directory?type=album' } ) .then( response => { if (response.length <= 0) return @@ -872,7 +875,7 @@ const MopidyMiddleware = (function(){ var processor = store.getState().ui.processes['MOPIDY_LIBRARY_ALBUMS_PROCESSOR'] if (processor.cancelling){ - store.dispatch(uiActions.processFinished('MOPIDY_LIBRARY_ALBUMS_PROCESSOR')) + store.dispatch(uiActions.processCancelled('MOPIDY_LIBRARY_ALBUMS_PROCESSOR')) return false } } @@ -1003,6 +1006,9 @@ const MopidyMiddleware = (function(){ **/ case 'MOPIDY_GET_LIBRARY_ARTISTS': + + store.dispatch({type: 'MOPIDY_LIBRARY_ARTISTS_CLEAR'}) + instruct( socket, store, 'library.browse', { uri: 'local:directory?type=artist' } ) .then( response => { if (response.length <= 0) return @@ -1024,7 +1030,7 @@ const MopidyMiddleware = (function(){ var processor = store.getState().ui.processes['MOPIDY_LIBRARY_ARTISTS_PROCESSOR'] if (processor.cancelling){ - store.dispatch(uiActions.processFinished('MOPIDY_LIBRARY_ARTISTS_PROCESSOR')) + store.dispatch(uiActions.processCancelled('MOPIDY_LIBRARY_ARTISTS_PROCESSOR')) return false } } diff --git a/src/js/services/mopidy/reducer.js b/src/js/services/mopidy/reducer.js index 7a1e5092..5873ccd2 100755 --- a/src/js/services/mopidy/reducer.js +++ b/src/js/services/mopidy/reducer.js @@ -151,6 +151,35 @@ export default function reducer(mopidy = {}, action){ } return Object.assign({}, mopidy, { library_albums: uris }) + + case 'MOPIDY_LIBRARY_PLAYLISTS_CLEAR': + return Object.assign({}, mopidy, { library_playlists: [] }) + + case 'MOPIDY_LIBRARY_ARTISTS_CLEAR': + return Object.assign({}, mopidy, { library_artists: [] }) + + case 'MOPIDY_LIBRARY_ALBUMS_CLEAR': + return Object.assign({}, mopidy, { library_albums: [] }) + + + case 'MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR_CANCELLED': + return Object.assign({}, mopidy, { library_playlists_status: 'cancelled' }) + + case 'MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR_FINISHED': + return Object.assign({}, mopidy, { library_playlists_status: 'finished' }) + + case 'MOPIDY_LIBRARY_ARTISTS_PROCESSOR_CANCELLED': + return Object.assign({}, mopidy, { library_artists_status: 'cancelled' }) + + case 'MOPIDY_LIBRARY_ARTISTS_PROCESSOR_FINISHED': + return Object.assign({}, mopidy, { library_artists_status: 'finished' }) + + case 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR_CANCELLED': + return Object.assign({}, mopidy, { library_albums_status: 'cancelled' }) + + case 'MOPIDY_LIBRARY_ALBUMS_PROCESSOR_FINISHED': + return Object.assign({}, mopidy, { library_albums_status: 'finished' }) + default: return mopidy } diff --git a/src/js/services/spotify/actions.js b/src/js/services/spotify/actions.js index 696c8435..6a0fc954 100755 --- a/src/js/services/spotify/actions.js +++ b/src/js/services/spotify/actions.js @@ -597,10 +597,10 @@ export function following(uri, method = 'GET'){ if( typeof(is_following) === 'object' ) is_following = is_following[0] dispatch({ - type: asset_name.toUpperCase()+'_LIBRARY_CHECK', + type: 'SPOTIFY_LIBRARY_'+asset_name.toUpperCase()+'_CHECK', key: uri, in_library: is_following - }); + }) }); } } @@ -1298,6 +1298,7 @@ export function reorderPlaylistTracks( uri, range_start, range_length, insert_be export function getLibraryPlaylists(){ return (dispatch, getState) => { + dispatch({type: 'SPOTIFY_LIBRARY_PLAYLISTS_CLEAR'}) dispatch(uiActions.startProcess('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR','Loading Spotify playlists', {next: 'me/playlists?limit=50'})) } } @@ -1317,7 +1318,7 @@ export function getLibraryPlaylistsProcessor(data){ var processor = getState().ui.processes['SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR'] if (processor.cancelling){ - dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR')) + dispatch(uiActions.processCancelled('SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR')) return false } } @@ -1343,6 +1344,7 @@ export function getLibraryPlaylistsProcessor(data){ export function getLibraryArtists(){ return (dispatch, getState) => { + dispatch({type: 'SPOTIFY_LIBRARY_ARTISTS_CLEAR'}) dispatch(uiActions.startProcess('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR','Loading Spotify artists', {next: 'me/following?type=artist&limit=50'})) } } @@ -1362,7 +1364,7 @@ export function getLibraryArtistsProcessor(data){ var processor = getState().ui.processes['SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR'] if (processor.cancelling){ - dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR')) + dispatch(uiActions.processCancelled('SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR')) return false } } @@ -1388,6 +1390,7 @@ export function getLibraryArtistsProcessor(data){ export function getLibraryAlbums(){ return (dispatch, getState) => { + dispatch({type: 'SPOTIFY_LIBRARY_ALBUMS_CLEAR'}) dispatch(uiActions.startProcess('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR','Loading Spotify albums', {next: 'me/albums?limit=50'})) } } @@ -1407,7 +1410,7 @@ export function getLibraryAlbumsProcessor(data){ var processor = getState().ui.processes['SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR'] if (processor.cancelling){ - dispatch(uiActions.processFinished('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR')) + dispatch(uiActions.processCancelled('SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR')) return false } } diff --git a/src/js/services/spotify/reducer.js b/src/js/services/spotify/reducer.js index c0822506..25f02494 100755 --- a/src/js/services/spotify/reducer.js +++ b/src/js/services/spotify/reducer.js @@ -174,6 +174,66 @@ export default function reducer(spotify = {}, action){ } return Object.assign({}, spotify, { library_albums: uris }) + + case 'SPOTIFY_LIBRARY_PLAYLISTS_CLEAR': + return Object.assign({}, spotify, { library_playlists: [] }) + + case 'SPOTIFY_LIBRARY_ARTISTS_CLEAR': + return Object.assign({}, spotify, { library_artists: [] }) + + case 'SPOTIFY_LIBRARY_ALBUMS_CLEAR': + return Object.assign({}, spotify, { library_albums: [] }) + + + case 'SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR_CANCELLED': + return Object.assign({}, spotify, { library_playlists_status: 'cancelled' }) + + case 'SPOTIFY_GET_LIBRARY_PLAYLISTS_PROCESSOR_FINISHED': + return Object.assign({}, spotify, { library_playlists_status: 'finished' }) + + case 'SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR_CANCELLED': + return Object.assign({}, spotify, { library_artists_status: 'cancelled' }) + + case 'SPOTIFY_GET_LIBRARY_ARTISTS_PROCESSOR_FINISHED': + return Object.assign({}, spotify, { library_artists_status: 'finished' }) + + case 'SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR_CANCELLED': + return Object.assign({}, spotify, { library_albums_status: 'cancelled' }) + + case 'SPOTIFY_GET_LIBRARY_ALBUMS_PROCESSOR_FINISHED': + return Object.assign({}, spotify, { library_albums_status: 'finished' }) + + + case 'SPOTIFY_LIBRARY_ALBUM_CHECK': + var items = Object.assign([], spotify.library_albums) + var index = items.indexOf(action.key) + if (index > -1 && !action.in_library){ + items.splice(index, 1) + } else if (index < 0 && action.in_library){ + items.push(action.key) + } + return Object.assign({}, spotify, { library_albums: items }); + + case 'SPOTIFY_LIBRARY_ARTIST_CHECK': + var items = Object.assign([], spotify.library_artists) + var index = items.indexOf(action.key) + if (index > -1 && !action.in_library){ + items.splice(index, 1) + } else if (index < 0 && action.in_library){ + items.push(action.key) + } + return Object.assign({}, spotify, { library_artists: items }); + + case 'SPOTIFY_LIBRARY_PLAYLIST_CHECK': + var items = Object.assign([], spotify.library_playlists) + var index = items.indexOf(action.key) + if (index > -1 && !action.in_library){ + items.splice(index, 1) + } else if (index < 0 && action.in_library){ + items.push(action.key) + } + return Object.assign({}, spotify, { library_playlists: items }); + default: return spotify } diff --git a/src/js/services/ui/actions.js b/src/js/services/ui/actions.js index 42e36cbc..517e8d8b 100755 --- a/src/js/services/ui/actions.js +++ b/src/js/services/ui/actions.js @@ -200,6 +200,13 @@ export function cancelProcess(key){ } } +export function processCancelled(key){ + return { + type: 'PROCESS_CANCELLED', + key: key + } +} + export function processFinished(key){ return { type: 'PROCESS_FINISHED', diff --git a/src/js/services/ui/middleware.js b/src/js/services/ui/middleware.js index 39f5b45e..e388e431 100755 --- a/src/js/services/ui/middleware.js +++ b/src/js/services/ui/middleware.js @@ -130,9 +130,16 @@ const UIMiddleware = (function(){ next(action) break - case 'CANCEL_PROCESS': + case 'PROCESS_CANCELLED': store.dispatch({ - type: action.key+'_CANCEL' + type: action.key+'_CANCELLED' + }) + next(action) + break + + case 'PROCESS_FINISHED': + store.dispatch({ + type: action.key+'_FINISHED' }) next(action) break diff --git a/src/js/services/ui/reducer.js b/src/js/services/ui/reducer.js index 8e72ae77..e935874f 100755 --- a/src/js/services/ui/reducer.js +++ b/src/js/services/ui/reducer.js @@ -153,6 +153,7 @@ export default function reducer(ui = {}, action){ } return Object.assign({}, ui, {processes: processes}) + case 'PROCESS_CANCELLED': case 'PROCESS_FINISHED': var processes = Object.assign({}, (ui.processes ? ui.processes : {})) if (processes[action.key]){ diff --git a/src/js/views/Album.js b/src/js/views/Album.js index aa71fb9f..b21dd3b2 100755 --- a/src/js/views/Album.js +++ b/src/js/views/Album.js @@ -92,7 +92,8 @@ class Album extends React.Component{ } inLibrary(){ - return (this.props.library_albums && this.props.library_albums.indexOf(this.props.params.uri) > -1) + var library = helpers.uriSource(this.props.params.uri)+'_library_albums' + return (this.props[library] && this.props[library].indexOf(this.props.params.uri) > -1) } render(){ @@ -172,7 +173,8 @@ const mapStateToProps = (state, ownProps) => { artists: state.core.artists, album: (state.core.albums && typeof(state.core.albums[ownProps.params.uri]) !== 'undefined' ? state.core.albums[ownProps.params.uri] : false ), albums: state.core.albums, - library_albums: state.core.library_albums, + spotify_library_albums: state.spotify.library_albums, + local_library_albums: state.mopidy.library_albums, spotify_authorized: state.spotify.authorization, mopidy_connected: state.mopidy.connected }; diff --git a/src/js/views/Artist.js b/src/js/views/Artist.js index 4ecc63dc..5ef45b16 100755 --- a/src/js/views/Artist.js +++ b/src/js/views/Artist.js @@ -82,7 +82,8 @@ class Artist extends React.Component{ } inLibrary(){ - return (this.props.library_artists && this.props.library_artists.indexOf(this.props.params.uri) > -1) + var library = helpers.uriSource(this.props.params.uri)+'_library_artists' + return (this.props[library] && this.props[library].indexOf(this.props.params.uri) > -1) } renderSubViewMenu(){ @@ -263,7 +264,8 @@ const mapStateToProps = (state, ownProps) => { load_queue: state.ui.load_queue, artist: (state.core.artists && typeof(state.core.artists[ownProps.params.uri]) !== 'undefined' ? state.core.artists[ownProps.params.uri] : false ), artists: (state.core.artists ? state.core.artists : []), - library_artists: (state.core.library_artists ? state.core.library_artists : []), + spotify_library_artists: state.spotify.library_artists, + local_library_artists: state.mopidy.library_artists, albums: (state.core.albums ? state.core.albums : []), spotify_authorized: state.spotify.authorization, mopidy_connected: state.mopidy.connected diff --git a/src/js/views/Playlist.js b/src/js/views/Playlist.js index b3a5f878..aebb944e 100755 --- a/src/js/views/Playlist.js +++ b/src/js/views/Playlist.js @@ -105,7 +105,8 @@ class Playlist extends React.Component{ } inLibrary(){ - return (this.props.library_playlists && this.props.library_playlists.indexOf(this.props.params.uri) > -1) + var library = helpers.uriSource(this.props.params.uri)+'_library_playlists' + return (this.props[library] && this.props[library].indexOf(this.props.params.uri) > -1) } renderActions(){ @@ -115,7 +116,7 @@ class Playlist extends React.Component{ return (
- + {this.props.slim_mode ? null : this.handleContextMenu(e)} />}
) @@ -125,7 +126,7 @@ class Playlist extends React.Component{ return (
- + {this.props.slim_mode ? null : this.handleContextMenu(e)} />}
) @@ -133,7 +134,7 @@ class Playlist extends React.Component{ return (
- + {this.props.slim_mode ? null : this.handleContextMenu(e)} />}
) @@ -214,8 +215,9 @@ const mapStateToProps = (state, ownProps) => { return { slim_mode: state.ui.slim_mode, load_queue: state.ui.load_queue, - playlist: (state.core.playlists && typeof(state.core.playlists[uri]) !== 'undefined' ? state.core.playlists[uri] : false ), - library_playlists: state.core.library_playlists, + playlist: (state.core.playlists && state.core.playlists[uri] !== undefined ? state.core.playlists[uri] : false ), + spotify_library_playlists: state.spotify.library_playlists, + local_library_playlists: state.mopidy.library_playlists, mopidy_connected: state.mopidy.connected, spotify_authorized: state.spotify.authorization, spotify_userid: state.spotify.me.id diff --git a/src/js/views/library/LibraryAlbums.js b/src/js/views/library/LibraryAlbums.js index 66ec7bfb..5f77fee8 100755 --- a/src/js/views/library/LibraryAlbums.js +++ b/src/js/views/library/LibraryAlbums.js @@ -30,11 +30,11 @@ class LibraryAlbums extends React.Component{ } componentDidMount(){ - if (!this.props.mopidy_library_albums && this.props.mopidy_connected && (this.props.source == 'all' || this.props.source == 'local')){ + if (this.props.mopidy_library_albums_status != 'finished' && this.props.mopidy_connected && (this.props.source == 'all' || this.props.source == 'local')){ this.props.mopidyActions.getLibraryAlbums() } - if (!this.props.spotify_library_albums && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ + if (this.props.spotify_library_albums_status != 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ this.props.spotifyActions.getLibraryAlbums() } } @@ -48,7 +48,7 @@ class LibraryAlbums extends React.Component{ } // Filter changed, but we haven't got this provider's library yet - if (this.props.source != 'all' && this.props.source != 'local' && !newProps.mopidy_library_albums){ + if (this.props.source != 'all' && this.props.source != 'local' && newProps.mopidy_library_albums_status != 'finished'){ this.props.mopidyActions.getLibraryAlbums() } } @@ -61,7 +61,7 @@ class LibraryAlbums extends React.Component{ } // Filter changed, but we haven't got this provider's library yet - if (this.props.source != 'all' && this.props.source != 'spotify' && !newProps.spotify_library_albums){ + if (this.props.source != 'all' && this.props.source != 'spotify' && newProps.spotify_library_albums_status != 'finished'){ this.props.spotifyActions.getLibraryAlbums() } } @@ -307,8 +307,10 @@ const mapStateToProps = (state, ownProps) => { spotify_connected: state.spotify.connected, load_queue: state.ui.load_queue, albums: state.core.albums, - spotify_library_albums: state.spotify.library_albums, mopidy_library_albums: state.mopidy.library_albums, + mopidy_library_albums_status: state.mopidy.library_albums_status, + spotify_library_albums: state.spotify.library_albums, + spotify_library_albums_status: state.spotify.library_albums_status, view: state.ui.library_albums_view, source: (state.ui.library_albums_source ? state.ui.library_albums_source : 'all'), sort: (state.ui.library_albums_sort ? state.ui.library_albums_sort : 'name'), diff --git a/src/js/views/library/LibraryArtists.js b/src/js/views/library/LibraryArtists.js index 3c73d5e9..4a830985 100755 --- a/src/js/views/library/LibraryArtists.js +++ b/src/js/views/library/LibraryArtists.js @@ -27,11 +27,11 @@ class LibraryArtists extends React.Component{ } componentDidMount(){ - if (!this.props.mopidy_library_artists && this.props.mopidy_connected && (this.props.source == 'all' || this.props.source == 'local')){ + if (this.props.mopidy_library_artists_status != 'finished' && this.props.mopidy_connected && (this.props.source == 'all' || this.props.source == 'local')){ this.props.mopidyActions.getLibraryArtists() } - if (!this.props.spotify_library_artists && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ + if (this.props.spotify_library_artists_status != 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ this.props.spotifyActions.getLibraryArtists() } } @@ -45,7 +45,7 @@ class LibraryArtists extends React.Component{ } // Filter changed, but we haven't got this provider's library yet - if (this.props.source != 'all' && this.props.source != 'local' && !newProps.mopidy_library_artists){ + if (this.props.source != 'all' && this.props.source != 'local' && newProps.mopidy_library_artists_status != 'finished'){ this.props.mopidyActions.getLibraryArtists() } } @@ -58,9 +58,9 @@ class LibraryArtists extends React.Component{ } // Filter changed, but we haven't got this provider's library yet - if (this.props.source != 'all' && this.props.source != 'spotify' && !newProps.spotify_library_artists){ + if (this.props.source != 'all' && this.props.source != 'spotify' && newProps.spotify_library_artists_status != 'finished'){ this.props.spotifyActions.getLibraryArtists() - } + } } } @@ -233,7 +233,9 @@ const mapStateToProps = (state, ownProps) => { mopidy_connected: state.mopidy.connected, spotify_connected: state.spotify.connected, mopidy_library_artists: state.mopidy.library_artists, + mopidy_library_artists_status: state.mopidy.library_artists_status, spotify_library_artists: state.spotify.library_artists, + spotify_library_artists_status: state.spotify.library_artists_status, artists: state.core.artists, source: (state.ui.library_artists_source ? state.ui.library_artists_source : 'all'), sort: (state.ui.library_artists_sort ? state.ui.library_artists_sort : 'name'), diff --git a/src/js/views/library/LibraryPlaylists.js b/src/js/views/library/LibraryPlaylists.js index e6ea917a..db36c3fd 100755 --- a/src/js/views/library/LibraryPlaylists.js +++ b/src/js/views/library/LibraryPlaylists.js @@ -32,7 +32,7 @@ class LibraryPlaylists extends React.Component{ this.props.mopidyActions.getLibraryPlaylists() } - if (!this.props.spotify_library_playlists && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ + if (this.props.spotify_library_playlists_status !== 'finished' && this.props.spotify_connected && (this.props.source == 'all' || this.props.source == 'spotify')){ this.props.spotifyActions.getLibraryPlaylists() } } @@ -59,7 +59,7 @@ class LibraryPlaylists extends React.Component{ } // Filter changed, but we haven't got this provider's library yet - if (this.props.source != 'all' && this.props.source != 'spotify' && !newProps.spotify_library_playlists){ + if (this.props.source != 'all' && this.props.source != 'spotify' && newProps.spotify_library_playlists_status !== 'finished'){ this.props.spotifyActions.getLibraryPlaylists() } } @@ -259,7 +259,9 @@ const mapStateToProps = (state, ownProps) => { mopidy_connected: state.mopidy.connected, spotify_connected: state.spotify.connected, mopidy_library_playlists: state.mopidy.library_playlists, + mopidy_library_playlists_status: state.mopidy.library_playlists_status, spotify_library_playlists: state.spotify.library_playlists, + spotify_library_playlists_status: state.spotify.library_playlists_status, slim_mode: state.ui.slim_mode, load_queue: state.ui.load_queue, me_id: (state.spotify.me ? state.spotify.me.id : (state.ui.config && state.ui.config.spotify_username ? state.ui.config.spotify_username : false)),