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

Error image not displayed in Compose Wasm #2786

Open
zsmb13 opened this issue Jan 14, 2025 · 2 comments
Open

Error image not displayed in Compose Wasm #2786

zsmb13 opened this issue Jan 14, 2025 · 2 comments
Labels
help wanted Issues that are up for grabs + are good candidates for community PRs

Comments

@zsmb13
Copy link

zsmb13 commented Jan 14, 2025

Describe the bug
When an URL fails to load, the "error" image is not displayed on the web target. I'm trying to test a case where I load a value like "invalid url".

image

The same code works fine on Desktop:

image

The logs show that loading the image fails, but it doesn't display the error resource:

🚨 Failed - invalid url
KotlinConfApp-ui-components-gallery-wasm-js.uninstantiated.mjs:129 IllegalStateException: Unable to create a fetcher that supports: invalid url
    at kotlin.captureStackTrace (webpack-internal:///./kotlin/KotlinConfApp-ui-components-gallery-wasm-js.uninstantiated.mjs:21:44)
    at <KotlinConfApp:ui-components-gallery>.kotlin.captureStackTrace__externalAdapter (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13473]:0x3c0e80)
    at <KotlinConfApp:ui-components-gallery>.kotlin.Throwable.<init> (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13463]:0x3c0cd6)
    at <KotlinConfApp:ui-components-gallery>.kotlin.Throwable.<init> (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13464]:0x3c0d0f)
    at <KotlinConfApp:ui-components-gallery>.kotlin.Exception.<init> (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13849]:0x3c543e)
    at <KotlinConfApp:ui-components-gallery>.kotlin.RuntimeException.<init> (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13839]:0x3c5260)
    at <KotlinConfApp:ui-components-gallery>.kotlin.IllegalStateException.<init> (http://localhost:8080/536236261657b35af741.wasm:wasm-function[13854]:0x3c552d)
    at <KotlinConfApp:ui-components-gallery>.coil3.intercept.$fetchCOROUTINE$4.doResume (http://localhost:8080/536236261657b35af741.wasm:wasm-function[61530]:0x81fcde)
    at <KotlinConfApp:ui-components-gallery>.coil3.intercept.EngineInterceptor.fetch (http://localhost:8080/536236261657b35af741.wasm:wasm-function[61541]:0x8203dc)
    at <KotlinConfApp:ui-components-gallery>.coil3.intercept.$executeCOROUTINE$3.doResume (http://localhost:8080/536236261657b35af741.wasm:wasm-function[61528]:0x81f7fa)

KotlinConfApp-ui-components-gallery-wasm-js.uninstantiated.mjs:129 🚨 Failed - invalid url

Other errors produce the correct behavior, for example, trying to load "https://example.com/not-an-image.jpg" throws a CORS error and displays the error drawable as expected. Just not completely invalid strings like the one shown here.

To Reproduce

AsyncImage(
    model = "invalid url",
    contentDescription = null,
    modifier = Modifier.size(96.dp),
    placeholder = painterResource(Res.drawable.kodee_emotion_positive), // Any value could go here
    error = painterResource(Res.drawable.kodee_emotion_neutral), // Any value could go here
)

Version
3.0.3

@colinrtwhite
Copy link
Member

Which version of Compose are you using? I wonder if it could be related to #2771.

@colinrtwhite colinrtwhite added the help wanted Issues that are up for grabs + are good candidates for community PRs label Jan 14, 2025
@zsmb13
Copy link
Author

zsmb13 commented Jan 14, 2025

This was on Compose 1.7.0. Happened on the 2025 branch of the KotlinConf app repo (here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that are up for grabs + are good candidates for community PRs
Projects
None yet
Development

No branches or pull requests

2 participants