Skip to content

Commit

Permalink
Execute on the main dispatcher if the request has a ViewSizeResolver.
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrtwhite committed Nov 19, 2024
1 parent ce00eab commit f6dbcfa
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import coil3.request.OneShotDisposable
import coil3.request.lifecycle
import coil3.request.requestManager
import coil3.request.transitionFactory
import coil3.size.ViewSizeResolver
import coil3.target.Target
import coil3.target.ViewTarget
import coil3.transition.NoneTransition
Expand All @@ -31,7 +32,9 @@ internal actual fun needsExecuteOnMainDispatcher(
request: ImageRequest,
): Boolean {
// Don't dispatch to the main thread unless we have to interact with a view or a lifecycle.
return request.target is ViewTarget<*> || request.lifecycle != null
return request.target is ViewTarget<*> ||
request.sizeResolver is ViewSizeResolver<*> ||
request.lifecycle != null
}

internal actual fun getDisposable(
Expand Down

0 comments on commit f6dbcfa

Please sign in to comment.