Skip to content

gif animation stops when I quickly switch URLs only on Target of watchOS #312

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

Closed
alfredcc opened this issue Apr 3, 2024 · 4 comments · Fixed by #316
Closed

gif animation stops when I quickly switch URLs only on Target of watchOS #312

alfredcc opened this issue Apr 3, 2024 · 4 comments · Fixed by #316
Labels
help wanted Extra attention is needed watchos webimage WebImage struct

Comments

@alfredcc
Copy link

alfredcc commented Apr 3, 2024

Hello, maintainer,
I have two strange bugs to report. I saw that the issue with loading a nil URL had been fixed before Fix nil url reloading, but it still exists on watchOS. Additionally, there's another issue on watchOS where the gif animation stops when I quickly switch URLs, which doesn't happen on the phone. I wrote a demo to easily reproduce this problem and created a file named FastSwitchGifView.

https://github.com/alfredcc/SDWebImageSwiftUI/tree/bug-report-on-watchOS

@alfredcc alfredcc changed the title gif animation stops when I quickly switch URLs on Target of watchOS gif animation stops when I quickly switch URLs only on Target of watchOS Apr 4, 2024
@alfredcc
Copy link
Author

alfredcc commented Apr 4, 2024

I find that the method onAppear is not called on wathOS when id changes
https://github.com/SDWebImage/SDWebImageSwiftUI/blob/master/SDWebImageSwiftUI/Classes/WebImage.swift?#L308

@dreampiggy
Copy link
Collaborator

If you read the code you will find only watchOS use different implementation. Because UIKit is not available

@alfredcc
Copy link
Author

alfredcc commented Apr 6, 2024

Yes, I saw that onPlatformAppear used UIKit/AppKit behavior. On watchOS, this fallback method was not used. The buggy behavior of onAppear in SwiftUI disrupted some logic. Therefore, currently, there isn't a very good way to handle this issue on watchOS.

@dreampiggy
Copy link
Collaborator

May find a way to remove the dependency of onPlatformAppear and implments the similiar effect.

But I doubt this will break that .indicator/.placeholder behavior, which behaves like a composition view, not a single stateful view (no sounds suitable for SwiftUI)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed watchos webimage WebImage struct
Projects
None yet
2 participants