Skip to content

Commit

Permalink
Merge pull request #1476 from ecency/bugfix/entry-image-fallback
Browse files Browse the repository at this point in the history
Fixed entry list item image fallback
  • Loading branch information
feruzm authored Oct 5, 2023
2 parents d1ef74d + a67357d commit 1bbb353
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/common/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export function useImageDownloader(

return (await blobToBase64(response.data)) as string;
} catch (e) {
return "";
return noImage;
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,11 @@ export function EntryListItemThumbnail({ entry, noImage, isCrossPost, entryProp,
src={imgGrid}
alt={isGridLoading ? "" : entry.title}
style={{ width: imgGrid === noImage ? "172px" : "auto" }}
onError={(e: React.SyntheticEvent) => {
const target = e.target as HTMLImageElement;
target.src = global.isElectron
? "./img/fallback.png"
: require("../../img/fallback.png");
}}
/>
) : (
<picture>
<source srcSet={imgRow} media="(min-width: 576px)" />
<img
srcSet={imgRow}
alt={isRowLoading ? "" : entry.title}
onError={(e: React.SyntheticEvent) => {
const target = e.target as HTMLImageElement;
target.src = global.isElectron
? "./img/fallback.png"
: require("../../img/fallback.png");
}}
/>
<img srcSet={imgRow} alt={isRowLoading ? "" : entry.title} />
</picture>
)}
</div>
Expand Down

0 comments on commit 1bbb353

Please sign in to comment.