mirror of https://github.com/lidarr/Lidarr
Fixed: Prevent Albums page from making double API calls
This commit is contained in:
parent
72dfae1cc9
commit
0b4e4a90bc
|
@ -34,6 +34,10 @@ const mapDispatchToProps = {
|
||||||
|
|
||||||
class AlbumDetailsPageConnector extends Component {
|
class AlbumDetailsPageConnector extends Component {
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = { hasMounted: false };
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
|
|
||||||
|
@ -50,6 +54,7 @@ class AlbumDetailsPageConnector extends Component {
|
||||||
|
|
||||||
populate = () => {
|
populate = () => {
|
||||||
const foreignAlbumId = this.props.foreignAlbumId;
|
const foreignAlbumId = this.props.foreignAlbumId;
|
||||||
|
this.setState({ hasMounted: true });
|
||||||
this.props.fetchAlbums({ foreignAlbumId });
|
this.props.fetchAlbums({ foreignAlbumId });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +80,7 @@ class AlbumDetailsPageConnector extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAlbumsFetching) {
|
if (isAlbumsFetching || !this.state.hasMounted) {
|
||||||
return (
|
return (
|
||||||
<LoadingIndicator />
|
<LoadingIndicator />
|
||||||
);
|
);
|
||||||
|
@ -87,7 +92,7 @@ class AlbumDetailsPageConnector extends Component {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAlbumsFetching && isAlbumsPopulated) {
|
if (!isAlbumsFetching && isAlbumsPopulated && this.state.hasMounted) {
|
||||||
return (
|
return (
|
||||||
<AlbumDetailsConnector
|
<AlbumDetailsConnector
|
||||||
foreignAlbumId={foreignAlbumId}
|
foreignAlbumId={foreignAlbumId}
|
||||||
|
|
Loading…
Reference in New Issue