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

[Compose] GlideSubcomposition state is changing from Loading-Success-Loading #5418

Open
jimmytrivediuser opened this issue Jun 5, 2024 · 0 comments

Comments

@jimmytrivediuser
Copy link

jimmytrivediuser commented Jun 5, 2024

I'm using the Glide Compose version, and the images were loading fine in the Alpha version. However, after switching to the Beta version, I started encountering this issue.

def glideComposeVersion = '1.0.0-alpha.3'
def glideComposeVersion = '1.0.0-beta01'

Older Alpha version code:

val placeholder = placeholder { CustomPlaceHolder(modifier = placeHolderModifier) }
                    GlideImage(
                        model = image?.image,
                        contentDescription = "image",
                        modifier = imageModifier,
                        contentScale = ContentScale.Fit,
                        alignment = Alignment.Center,
                        colorFilter = null,
                        alpha = DefaultAlpha,
                        loading = placeholder,
                        failure = placeholder
                    ) {
                        it.diskCacheStrategy(DiskCacheStrategy.ALL)
                    }](url)

Newer Beta version code:

GlideSubcomposition(
                        image?.image,
                        imageModifier,
                        { it.diskCacheStrategy(DiskCacheStrategy.ALL) }) {

                        if (state !is RequestState.Success) {
                            CustomPlaceHolder(modifier = placeHolderModifier)
                        } else {
                            Image(
                                painter,
                                contentDescription = "image",
                                imageModifier,
                                contentScale = ContentScale.Fit,
                                alignment = Alignment.Center,
                                colorFilter = null,
                                alpha = DefaultAlpha,
                            )
                        }
                    }

Troubleshooting
When I printed state in the Beta version, it first shows loading, then success, and then switches back to loading. As a result, the images on the UI flicker and disappear.

@jimmytrivediuser jimmytrivediuser changed the title GlideSubcomposition is changing from Loading-Success-Loading [Compose] GlideSubcomposition state is changing from Loading-Success-Loading Jun 5, 2024
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

1 participant