Fixed: Spotify playlists not shown after authentication

This commit is contained in:
Qstick 2021-01-19 23:08:46 -05:00
parent 419ec2bdb9
commit 7b43657a07
2 changed files with 11 additions and 8 deletions

View file

@ -180,7 +180,8 @@ PlaylistInput.propTypes = {
PlaylistInput.defaultProps = { PlaylistInput.defaultProps = {
className: styles.playlistInputWrapper, className: styles.playlistInputWrapper,
inputClassName: styles.input inputClassName: styles.input,
isPopulated: false
}; };
export default PlaylistInput; export default PlaylistInput;

View file

@ -3,20 +3,21 @@ import PropTypes from 'prop-types';
import React, { Component } from 'react'; import React, { Component } from 'react';
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { clearOptions, fetchOptions } from 'Store/Actions/providerOptionActions'; import { clearOptions, defaultState, fetchOptions } from 'Store/Actions/providerOptionActions';
import PlaylistInput from './PlaylistInput'; import PlaylistInput from './PlaylistInput';
function createMapStateToProps() { function createMapStateToProps() {
return createSelector( return createSelector(
(state) => state.providerOptions, (state) => state.providerOptions.playlists || defaultState,
(state) => { (playlists) => {
const { const {
items, items,
...otherState ...otherState
} = state; } = playlists;
return ({ return ({
user: items.user ? items.user : '', user: items && items.user ? items.user : '',
items: items.playlists ? items.playlists : [], items: items && items.playlists ? items.playlists : [],
...otherState ...otherState
}); });
} }
@ -48,7 +49,7 @@ class PlaylistInputConnector extends Component {
} }
componentWillUnmount = () => { componentWillUnmount = () => {
this.props.dispatchClearOptions(); this.props.dispatchClearOptions({ section: 'playlists' });
} }
// //
@ -62,6 +63,7 @@ class PlaylistInputConnector extends Component {
} = this.props; } = this.props;
dispatchFetchOptions({ dispatchFetchOptions({
section: 'playlists',
action: 'getPlaylists', action: 'getPlaylists',
provider, provider,
providerData providerData