Repository navigation
fix: keep the image when its full-size version fails to load - #8547
Open
ThreadCrash wants to merge 1 commit into
Open
ThreadCrash wants to merge 1 commit into
ThreadCrash wants to merge 1 commit into
Conversation
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.
Contributor
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
Tick the box to add this pull request to the merge queue (same as
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7907
FullImageswaps the image torawSrcon 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'sraw_avatar_urlreturns 400, for example. The swapped image then fireserror, and that error reachesAvatar, which setsfailedand 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 anerroremit and listens itself:rawSrcisn't tried againAvatar's placeholderTested in Storybook with an
AvatarwhoserawSrcis AutoMod's raw avatar URL:rawSrcstill swaps in and reverts as beforesrcfails still shows the placeholdereslint and prettier pass on the file.