Last remaining componentWillReceiveProps, whew
This commit is contained in:
@ -47,23 +47,30 @@ class LibraryPlaylists extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
componentWillReceiveProps(newProps) {
|
||||
if (newProps.mopidy_connected && (newProps.source == 'all' || newProps.source == 'local')) {
|
||||
// We've just connected
|
||||
if (!this.props.mopidy_connected) {
|
||||
this.props.mopidyActions.getLibraryPlaylists();
|
||||
}
|
||||
componentDidUpdate = ({
|
||||
mopidy_connected: prev_mopidy_connected,
|
||||
}) => {
|
||||
const {
|
||||
source,
|
||||
mopidy_connected,
|
||||
mopidy_library_playlists,
|
||||
spotify_enabled,
|
||||
spotify_library_playlists_status,
|
||||
mopidyActions,
|
||||
spotifyActions,
|
||||
} = this.props;
|
||||
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (this.props.source != 'all' && this.props.source != 'local' && !newProps.mopidy_library_playlists) {
|
||||
if (mopidy_connected && (source == 'all' || source == 'local')) {
|
||||
if (!prev_mopidy_connected) mopidyActions.getLibraryPlaylists();
|
||||
|
||||
if (source !== 'all' && source !== 'local' && !mopidy_library_playlists) {
|
||||
this.props.mopidyActions.getLibraryPlaylists();
|
||||
}
|
||||
}
|
||||
|
||||
if (newProps.spotify_enabled && (newProps.source == 'all' || newProps.source == 'spotify')) {
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (newProps.spotify_library_playlists_status != 'finished' && newProps.spotify_library_playlists_status != 'started') {
|
||||
this.props.spotifyActions.getLibraryPlaylists();
|
||||
if (spotify_enabled && (source === 'all' || source === 'spotify')) {
|
||||
if (spotify_library_playlists_status !== 'finished' && spotify_library_playlists_status !== 'started') {
|
||||
spotifyActions.getLibraryPlaylists();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user