Functional-component-ifying Parallax to silence unmount issues; artistSelector to include albums, still doesn't avoid unnecessary renders though
This commit is contained in:
@ -29,7 +29,7 @@ import { i18n, I18n } from '../locale';
|
||||
import Button from '../components/Button';
|
||||
import { trackEvent } from '../components/Trackable';
|
||||
import {
|
||||
makeItemSelector,
|
||||
makeArtistSelector,
|
||||
makeLoadingSelector,
|
||||
} from '../util/selectors';
|
||||
import { nice_number } from '../components/NiceNumber';
|
||||
@ -193,8 +193,8 @@ class Artist extends React.Component {
|
||||
let {
|
||||
tracks,
|
||||
related_artists,
|
||||
albums,
|
||||
} = artist;
|
||||
let { albums } = this.props;
|
||||
|
||||
if (sort && albums) {
|
||||
albums = sortItems(albums, sort, sort_reverse);
|
||||
@ -601,21 +601,15 @@ class Artist extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
const uri = decodeURIComponent(ownProps.match.params.uri);
|
||||
const mapStateToProps = (state, props) => {
|
||||
const uri = decodeURIComponent(props.match.params.uri);
|
||||
const loadingSelector = makeLoadingSelector([`(.*)${uri}(.*)`, '^((?!contains).)*$', '^((?!albums).)*$', '^((?!related-artists).)*$', '^((?!top-tracks).)*$']);
|
||||
const artistSelector = makeItemSelector(uri);
|
||||
const artistSelector = makeArtistSelector(uri);
|
||||
const artist = artistSelector(state);
|
||||
let albums = null;
|
||||
if (artist && artist.albums_uris) {
|
||||
const albumsSelector = makeItemSelector(artist.albums_uris);
|
||||
albums = albumsSelector(state);
|
||||
}
|
||||
|
||||
return {
|
||||
uri,
|
||||
artist,
|
||||
albums,
|
||||
loading: loadingSelector(state),
|
||||
theme: state.ui.theme,
|
||||
slim_mode: state.ui.slim_mode,
|
||||
|
||||
Reference in New Issue
Block a user