Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error image with custom Placeholder fix #1925

Merged
merged 7 commits into from
Apr 7, 2022

Conversation

PJ-LT
Copy link
Contributor

@PJ-LT PJ-LT commented Mar 22, 2022

This fixes an issue where custom Placeholders are never removed when an error occurs even when there is an Error Image that should be shown instead.

Steps to reproduce:

  1. Add custom placeholder
  2. Add Error Image
  3. Load image with an Error
  4. Placeholder always shows because it is never removed

Note: Unit Test added for UIKit failed without fix and passes with fix

@PJ-LT
Copy link
Contributor Author

PJ-LT commented Apr 6, 2022

Any chance of this being looked at?

@onevcat
Copy link
Owner

onevcat commented Apr 7, 2022

@PJ-LT Sorry for the late reply. It looks good to me and I was just a bit busy recently on other projects. I will merge and tag it ASAP! Thanks for the contribution!

@onevcat onevcat merged commit 84bf4f2 into onevcat:master Apr 7, 2022
@PJ-LT
Copy link
Contributor Author

PJ-LT commented Apr 7, 2022

@onevcat Awesome, thanks so much!

Comment on lines 55 to +61
CallbackQueue.mainCurrentOrAsync.execute {
context.onFailureDelegate.call(KingfisherError.imageSettingError(reason: .emptySource))
if let image = context.options.onFailureImage {
self.loadedImage = image
}
self.loading = false
self.loaded = true

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to pass weak or unowned self here?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. It is not necessary.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants