coil-kt / coil

Image loading for Android and Compose Multiplatform.
https://coil-kt.github.io/coil/
Apache License 2.0
10.7k stars 649 forks source link

IRLinkage error on Kotlin/Js #2231

Closed N7ghtm4r3 closed 4 months ago

N7ghtm4r3 commented 5 months ago

Describe the bug Hi, using Coil3 on a Kotlin/Js project using the AsyncImage api this error occurred:

{
    "message": "Function 'setContent$composable' can not be called: No function found for symbol 'androidx.compose.runtime/ControlledComposition.setContent$composable|9062691686831257511[0]'",
    "name": "IrLinkageError"
}

and the related web page will be blank with no content displayed

To Reproduce In a Kotlin/Js project using the AsyncImage api and the error occurs ispecting the webpage in the Console tab will be printed the error

Logs/Screenshots Following there is a screenshot about how the web page results and the error printed in the Console section of the browser Screenshot 2024-05-06 173601

Version

Implemented in the commonMain.dependencies resources set:

io.coil-kt.coil3:coil-compose:3.0.0-alpha06 io.coil-kt.coil3:coil-network-ktor:3.0.0-alpha06

colinrtwhite commented 5 months ago

This seems like it might be a Compose error unrelated to Coil as Coil isn't mentioned in the error. Are you able to reproduce error only importing Compose Multiplatform?

The error might be related to local configuration. I'm able to run ./gradlew samples:compose:jsRun to run the JS sample in this repository.

N7ghtm4r3 commented 4 months ago

The error occurred only when the dependencies I said in the previous comment are imported, without these the composition goes well and the content of the page is not blank, I don't understand the usages of the comment you said ./gradlew samples:compose:jsRun I need to run and share to you the result or is the proof that for you works correctly?

colinrtwhite commented 4 months ago

To Reproduce: In a Kotlin/Js project using the AsyncImage api and the error occurs ispecting the webpage in the Console tab will be printed the error

I'm not able to reproduce the exception using the sample JS app in this repo which imports AsyncImage. Do you have a sample that reproduces the issue?

N7ghtm4r3 commented 4 months ago

Yes, I share with you the demo project where I am trying to implement the Coil library, it works based on the Kobweb library, so I think you should install if the project has not the gradle tasks required. You can download the demo project from WeTransfer at the email you have in your profile of GitHub, this because I cannot attach here due its size

colinrtwhite commented 4 months ago

Kobweb is based on Compose HTML, but Coil uses Compose Multiplatform. It's likely that you need to set up your project for Compose Multiplatform similar to here.

N7ghtm4r3 commented 4 months ago

Yes I'm sorry I totally forgot this requirement about Compose HTML is not Compose Multiplatform, thanks for the help