mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-13 02:07:12 -07:00
Fixed: Prevent Albums page from making double API calls
This commit is contained in:
parent
72dfae1cc9
commit
0b4e4a90bc
1 changed files with 7 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue