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

Start loading when evaluating view #1828

Merged
merged 2 commits into from
Oct 3, 2021
Merged

Conversation

onevcat
Copy link
Owner

@onevcat onevcat commented Oct 3, 2021

This fixes #1821

Currently the loading will not start until the onAppear of the placeholder shown, which is too late for a sync loading from disk or memory. It causes an unwanted flickering. This PR moves the loading starting earlier to the beginning of KFImageRenderer.body. The loading method call (and its states in ImageBinder) is protected by the main thread, so it would not actually run more than once, which should be pretty light.

Also added a loading property to prevent situations that image loading without an actual downloading process (say, applying a processor to a cached image). Before this fix, it will be recognized as "not loadingOrSucceeded" and triggers multiple start loading behaviors since the body will be evaluated for multiple times.

@onevcat onevcat merged commit 1c27757 into master Oct 3, 2021
@onevcat onevcat deleted the fix/binder-loading-timing branch October 3, 2021 09:07
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.

Changing a KFImage URL briefly flashes placeholder image
1 participant