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

Plugin is not working properly with SDWebImageSwiftUI versions >2.1.0 #2

Open
kpacholak opened this issue Mar 28, 2023 · 2 comments
Open

Comments

@kpacholak
Copy link

kpacholak commented Mar 28, 2023

Hi!
I've just discovered that if you update SDWebImageSwiftUI to higher version than 2.1.0, snapshots (swift snapshot-testing) are no longer properly generated. I can't see any images cached by SDWebImageMockPlugin.

2.1.0 is the last version which works for me.

Can anyone check and confirm that?
All the best!
Krzysztof

@alexandre-pod
Copy link
Member

Hi, thanks for raising this issue with latest version of SDWebImageSwiftUI.
I gave it a try and I find the same issues that you had, the images are not rendered on the snapshots.

By looking at the code of SDWebImageSwiftUI I found that the changes in that pull request is causing the issue: SDWebImage/SDWebImageSwiftUI#232.
The backport behavior is adding a DispatchQueue.main.async (this one) between the appearance of the WebImage and the loading of the image, and this is preventing the snapshot to be taken with the image.

I can suggest you a workaround to make your tests pass (if it works for you): 11abca6

Let me know if it helped you.

@kpacholak
Copy link
Author

Hi Alexandre! I can confirm - your workaround works
Executed 1 test, with 0 failures (0 unexpected) in 0.246 (0.250) seconds 👌

Are you planning to provide a patch?

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

No branches or pull requests

2 participants