Skip to content

fix: keep the image when its full-size version fails to load - #8547

Open
ThreadCrash wants to merge 1 commit into
modrinth:mainfrom
ThreadCrash:fix/full-image-missing-raw
Open

ThreadCrash wants to merge 1 commit into
modrinth:mainfrom
ThreadCrash:fix/full-image-missing-raw

Conversation

@ThreadCrash

Copy link
Copy Markdown
Contributor

Fixes #7907

FullImage swaps the image to rawSrc on right-click, long-press and drag, so the full-size image is the one that gets saved or dragged. Not every image has a full-size version. AutoMod's raw_avatar_url returns 400, for example. The swapped image then fires error, and that error reaches Avatar, which sets failed and replaces the image with its placeholder until the page is reloaded. This happens on right-click or long-press of AutoMod's avatar, and also when the left button is held on it.

#7946 tried to revert on error, but Avatar's own error listener still ran, so the placeholder still appeared.

The fix keeps the change inside FullImage, which now declares an error emit and listens itself:

  • an error while the full-size image is swapped in puts the original image back, and that rawSrc isn't tried again
  • any other error is emitted as before, so a broken image still gets Avatar's placeholder

Tested in Storybook with an Avatar whose rawSrc is AutoMod's raw avatar URL:

  • before the fix, right-click turned the avatar into the placeholder
  • with the fix, right-click and a held left click both swap back to the original image
  • a working rawSrc still swaps in and reverts as before
  • an image whose normal src fails still shows the placeholder

eslint and prettier pass on the file.

FullImage swaps to rawSrc on right-click, long-press and drag so the full-size
image is the one saved or dragged. Some images have no full-size version (the
AutoMod avatar's raw URL returns 400), and the error from the swapped image
reached Avatar, which replaced the image with its placeholder for good.

FullImage now handles errors itself: an error while swapped puts the original
image back and stops trying that rawSrc, and any other error is passed on.
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Dec 3, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

The script that loads the higher res version of a PFP fails back incorrectly if one doesn't exist

1 participant