Misc UI Updates

This commit is contained in:
Qstick 2017-10-28 16:13:32 -04:00
parent 1b64171b30
commit cb9af37c39
6 changed files with 65 additions and 6 deletions

View file

@ -1,6 +1,7 @@
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import { align, icons } from 'Helpers/Props';
import hasDifferentItems from 'Utilities/Object/hasDifferentItems';
import LoadingIndicator from 'Components/Loading/LoadingIndicator';
import Table from 'Components/Table/Table';
import TableBody from 'Components/Table/TableBody';
@ -17,6 +18,27 @@ import HistoryRowConnector from './HistoryRowConnector';
class History extends Component {
//
// Lifecycle
shouldComponentUpdate(nextProps) {
// Don't update when fetching has completed if items have changed,
// before albums start fetching or when albums start fetching.
if (
(
this.props.isFetching &&
nextProps.isPopulated &&
hasDifferentItems(this.props.items, nextProps.items)
) ||
(!this.props.isAlbumsFetching && nextProps.isAlbumsFetching)
) {
return false;
}
return true;
}
//
// Render

View file

@ -37,6 +37,24 @@ class Queue extends Component {
};
}
shouldComponentUpdate(nextProps) {
// Don't update when fetching has completed if items have changed,
// before albums start fetching or when albums start fetching.
if (
(
this.props.isFetching &&
nextProps.isPopulated &&
hasDifferentItems(this.props.items, nextProps.items)
) ||
(!this.props.isAlbumsFetching && nextProps.isAlbumsFetching)
) {
return false;
}
return true;
}
componentDidUpdate(prevProps) {
if (hasDifferentItems(prevProps.items, this.props.items)) {
this.setState({ selectedState: {} });