Progress loading check for null, not 0
This commit is contained in:
@ -60,13 +60,15 @@ const makeProcessProgressSelector = (keys) => createSelector(
|
||||
.map((key) => processes[key] || {})
|
||||
.filter((i) => i.status === 'running');
|
||||
|
||||
if (!selectedProcesses.length) return null;
|
||||
|
||||
let total = 0;
|
||||
let remaining = 0;
|
||||
selectedProcesses.forEach((process) => {
|
||||
if (process.total) total += process.total;
|
||||
if (process.remaining) remaining += process.remaining;
|
||||
});
|
||||
return total && remaining ? ((total - remaining) / total).toFixed(4) : 1;
|
||||
return total && remaining ? ((total - remaining) / total).toFixed(4) : 0;
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ class LibraryAlbums extends React.Component {
|
||||
} = this.state;
|
||||
let { albums } = this.props;
|
||||
|
||||
if (loading_progress < 1) {
|
||||
if (loading_progress !== null) {
|
||||
return <Loader body loading progress={loading_progress} />;
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ class LibraryAlbums extends React.Component {
|
||||
filter,
|
||||
per_page,
|
||||
} = this.state;
|
||||
const loading = loading_progress < 1;
|
||||
const loading = loading_progress !== null;
|
||||
|
||||
const source_options = [
|
||||
{
|
||||
|
||||
@ -17,7 +17,6 @@ import Button from '../../components/Button';
|
||||
import Loader from '../../components/Loader';
|
||||
import {
|
||||
makeLibrarySelector,
|
||||
makeLoadingSelector,
|
||||
makeProcessProgressSelector,
|
||||
} from '../../util/selectors';
|
||||
|
||||
@ -172,8 +171,8 @@ class LibraryArtists extends React.Component {
|
||||
} = this.state;
|
||||
let { artists } = this.props;
|
||||
|
||||
if (loading_progress < 1) {
|
||||
return <Loader body loading progress={loading_progress} />
|
||||
if (loading_progress !== null) {
|
||||
return <Loader body loading progress={loading_progress} />;
|
||||
}
|
||||
|
||||
if (sort) {
|
||||
@ -229,7 +228,7 @@ class LibraryArtists extends React.Component {
|
||||
google_available,
|
||||
loading_progress,
|
||||
} = this.props;
|
||||
const loading = loading_progress < 1;
|
||||
const loading = loading_progress !== null;
|
||||
|
||||
const source_options = [
|
||||
{
|
||||
|
||||
@ -159,7 +159,7 @@ class LibraryPlaylists extends React.Component {
|
||||
limit,
|
||||
} = this.state;
|
||||
|
||||
if (loading_progress < 1) {
|
||||
if (loading_progress !== null) {
|
||||
return <Loader body loading progress={loading_progress} />;
|
||||
}
|
||||
let playlists = [...playlistsProp];
|
||||
@ -225,7 +225,7 @@ class LibraryPlaylists extends React.Component {
|
||||
const {
|
||||
filter,
|
||||
} = this.state;
|
||||
const loading = loading_progress < 1;
|
||||
const loading = loading_progress !== null;
|
||||
|
||||
const source_options = [
|
||||
{
|
||||
|
||||
@ -173,7 +173,7 @@ class LibraryTracks extends React.Component {
|
||||
} = this.state;
|
||||
let { tracks } = this.props;
|
||||
|
||||
if (loading_progress < 1) {
|
||||
if (loading_progress !== null) {
|
||||
return <Loader body loading progress={loading_progress} />;
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ class LibraryTracks extends React.Component {
|
||||
filter,
|
||||
per_page,
|
||||
} = this.state;
|
||||
const loading = loading_progress < 1;
|
||||
const loading = loading_progress !== null;
|
||||
|
||||
const source_options = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user