Any idea why my MP project targetting JS and Andro...
# multiplatform
j
Any idea why my MP project targetting JS and Android fails to compile on JS with
e: kotlin.NotImplementedError: Generation of stubs for class org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl is not supported yet
but on Android it works completely fine. Newest Compose, Kotlin, Gradle and AGP version. Link: https://github.com/jan-tennert/EinkaufszettelMP
p
You can ask in #compose-web
j
I mean it isn't necessarily a compose issue, it compiled before this commit (and it already included compose)
p
Let me see
Try commenting out one dependency at a time.
Is either koin or voyager
I think somebody was having some issues with voyager and kotlin 1.9.20
j
Okay its koin-compose 🤔
I'll create an issue
p
I see you added a specific koin artifact for Android, don't you miss the counter side in JS?
j
The koin-android dependency just includes things to add the android context etc. nothing you need on other targets
p
I see you are correct
JS is just commonMain
j
okay nvm can't repoduce it in another project. Also just commenting the content of the method
Content
in this file: https://github.com/jan-tennert/EinkaufszettelNext/blob/master/composeApp/src/commo[…]otlin/io/github/jan/einkaufszettel/ui/screen/auth/AuthScreen.kt Also fixes the compilation error
(the dependency is still there)
p
Interesting, cmd + click to see what's inside
Is that a Composable extension function on ?
j
It's my own dependency, it's this and/or the implementation (for JS)
p
Yeah is a Composable extension function, I believe JS compiler was still struggling with this.
If I am not mistaken there are some open issues for these
Try changing your design.
Remove the Composable in the extension function and just call a regular Composable function that internally call the extension function
j
I'm confused, so the
ComposeAuth.rememberLoginWithGoogle
shouldn't be an extension function?
p
The Composable annotation on it
Try without it.
j
yea but the implementation does need to be in a composable, or doesn't that matter?
the implementation (in this case JS) calls
defaultLoginBehavior
which itself uses a LaunchedEffect
p
Try like this see if it works
Copy code
actual fun ComposeAuth.rememberLoginWithGoogle(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit): NativeSignInState = defaultLoginBehavior(fallback)

@Composable 
actual rememberLoginWithGoogleWrap(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit) {
    rememberLoginWithGoogle(fallback)
}

// commonMain
@Composable 
expect rememberLoginWithGoogleWrap(onResult: (NativeSignInResult) -> Unit, fallback: suspend () -> Unit)
j
so I just remove the composable annotation on
rememberLoginWithGoogle
?
p
Yes
j
also on the common
rememberLoginWithGoogle
or just the JS actual one?
p
You have to do it in commonMain or the compiler will complain
j
okay so both
👌 1
Okay publishing it to maven local rn, but shouldn't it generally complain because rememberLoginWithGoogle (which is not a composable) calls a composable function?
p
Yes that is right, let me read the code again
I think you will have to call
defaultLoginBehavior
directly
j
hmm that is definitly inconvenient
p
It is yes
Not sure if making it inline could help, But still you can call inline from Composab;e but not the other way
j
yea thought about that too but that doesn't sound like the right solution
I'll try that and see if it helps
p
I know, It is hard to mix the JS target with other target because this type of things.
You can’t use all the kotlin goodies
j
probably will do a workaround for my project for now, I don't know how I could fix that in the dependency so that it doesn't break other things
p
I actually checked and I have similar code in some of my projects and it compiles. Uses an extension lambda
Can you check the library you are using, what kotlin version it was compiled with. I am thinking of some binary incompatibility or something
Copy code
val TopBarComponentView: @Composable TopBarComponent<TopBarComponentViewModel>.(
        modifier: Modifier,
        activeChildComponent: Component
    ) -> Unit = { modifier, activeChildComponent -> ... }
That works for me an is basically a lambda extension function. Maybe a lambda works for you The only thing I don't see is the expect/actual symbol. Hopefully has nothing to do with it
j
Hey, so both the library and my app use Kotlin 1.9.20 and Compose 1.5.10, and for your solution: I can try that but that would obviously be a breaking change
p
Ah I see 👍