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

Glide Compose: java.lang.IllegalArgumentException caused by sideEffect run asynchronously #5392

Open
hehua2008 opened this issue Apr 1, 2024 · 0 comments

Comments

@hehua2008
Copy link

hehua2008 commented Apr 1, 2024

The GlideNode call to reproduce the bug:
->1st onNewReuest
-> invalidateDraw
-> onAttach
-> launchRequest(schedule 1st sideEffect)

-> 2nd onNewRequest(requestBuilder not changed but loadingPlaceholder or errorPlaceholder changed -> restartLoad=true)
-> launchRequest(schedule 2nd sideEffect)

-> 1st sideEffect run and (currentJob=newValue)
-> 2nd sideEffect run (requestBuilder not changed) but Preconditions.checkArgument(currentJob == null) throw java.lang.IllegalArgumentException

e.g:

    val placeholderPair = remember(loadingPainter, failurePainter) {
        placeholder(loadingPainter) to placeholder(failurePainter)
    }
    val switch = Random.nextBoolean()

    GlideImage(
        model = url,
        contentDescription = url,
        contentScale = ContentScale.FillWidth,
        loading = if (!switch) placeholderPair.first else placeholderPair.second,
        failure = if (!switch) placeholderPair.second else placeholderPair.first,
        modifier = modifier
            .fillMaxWidth()
            .aspectRatio(1f)
    )
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