1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-24 08:42:53 +00:00

Fixed: Artist and Album Posters show placeholder instead of image (#292)

* Fixed issue where after AlbumPoster had error state, non-errored images would be stuck with placeholder.

* Fixed the poster loading issue for artists as well.

* Updated ArtistBanner as well.

* fixup: banner issues from previous missed update

* fixup! remove lazy variable, fix variable
This commit is contained in:
Joseph Milazzo 2018-04-15 00:11:53 -05:00 committed by Qstick
parent 9bd020a130
commit 2b2c242c6f
3 changed files with 27 additions and 24 deletions

View file

@ -58,16 +58,23 @@ class AlbumCover extends Component {
pixelRatio pixelRatio
} = this.state; } = this.state;
const nextcover = findCover(images); const nextCover = findCover(images);
if (nextcover && (!cover || nextcover.url !== cover.url)) { if (nextCover && (!cover || nextCover.url !== cover.url)) {
this.setState({ this.setState({
cover: nextcover, cover: nextCover,
coverUrl: getCoverUrl(nextcover, pixelRatio * size), coverUrl: getCoverUrl(nextCover, pixelRatio * size),
hasError: false hasError: false,
// Don't reset isLoaded, as we want to immediately try to isLoaded: true
// show the new image, whether an image was shown previously });
// or the placeholder was shown. }
// The cover could not be loaded..
if (!nextCover && (this.props !== prevProps)) {
this.setState({
cover: undefined,
coverUrl: coverPlaceholder,
hasError: true
}); });
} }
} }

View file

@ -64,20 +64,18 @@ class ArtistBanner extends Component {
this.setState({ this.setState({
banner: nextBanner, banner: nextBanner,
bannerUrl: getBannerUrl(nextBanner, pixelRatio * size), bannerUrl: getBannerUrl(nextBanner, pixelRatio * size),
hasError: false hasError: false,
// Don't reset isLoaded, as we want to immediately try to isLoaded: true
// show the new image, whether an image was shown previously
// or the placeholder was shown.
}); });
}
// The poster could not be loaded.. // The banner could not be loaded..
if (!nextBanner && (this.props !== prevProps)) { if (!nextBanner && (this.props !== prevProps)) {
this.setState({ this.setState({
banner: undefined, banner: undefined,
bannerUrl: bannerPlaceholder, bannerUrl: bannerPlaceholder,
hasError: true hasError: true
}); });
}
} }
} }

View file

@ -64,10 +64,8 @@ class ArtistPoster extends Component {
this.setState({ this.setState({
poster: nextPoster, poster: nextPoster,
posterUrl: getPosterUrl(nextPoster, pixelRatio * size), posterUrl: getPosterUrl(nextPoster, pixelRatio * size),
hasError: false hasError: false,
// Don't reset isLoaded, as we want to immediately try to isLoaded: true
// show the new image, whether an image was shown previously
// or the placeholder was shown.
}); });
} }