Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/common/playlists/PlayThumbnail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,27 @@ const PlayThumbnail = ({ play }) => {
const loadCover = async () => {
try {
if (play.cover) {
setCover(play.cover);
const img = new Image();
img.onload = () => {
setCover(play.cover);
};
img.onerror = async () => {
const image = await loadCoverImage(play.slug);
setCover(image);
};
img.src = play.cover;
} else {
const image = await loadCoverImage(play.slug);
setCover(image);
}
} catch (error) {
console.error(error);
try {
const image = await loadCoverImage(play.slug);
setCover(image);
} catch (fallbackError) {
console.error('Failed to load both external and local images:', fallbackError);
}
}
};
loadCover();
Expand Down
Binary file added src/plays/password-generator/cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading