Hi all, i am trying to integrate koin, with decom...
# koin
s
Hi all, i am trying to integrate koin, with decompose in compose multiplatform app, its working fine for android, ios, and desktop. But in case of web i m getting some error:
Copy code
Uncaught TypeError: $this.homeComponentFactory_1.create_esiqto_k$ is not a function
    at child_2 (WebDesktopDefaultRootComponent.kt:234:38)
    at DefaultChildItemFactory.l [as childFactory_1] (Your-Flixer-shared.js:15326:14)
    at protoOf.invoke_9e5oyy_k$ (DefaultChildItemFactory.kt:32:13)
    at DefaultChildItemFactory.invoke$default [as invoke$default_bfpx9a_k$] (Decompose-decompose-js-ir.js:135:35)
    at protoOf.prepareNewItems_obvoel_k$ (Standard.kt:158:2001)
    at protoOf.switch_55pz6e_k$ (ChildrenNavigator.kt:117:24)
    at new ChildrenNavigator (ChildrenNavigator.kt:44:13)
    at children (ChildrenFactory.kt:80:13)
    at childStack_0 (ChildStackFactory.kt:91:5)
    at childStack (ChildStackFactory.kt:40:5)
I am initializing koin above main method in main.js.kt, ANd i am passing the factories of components in root component(WebDesktopDefaultRootComponent), but while during childFactory setup, it tries to create component using those factories create method, it shows this error. And for those factories also i have one koin module that i m adding in koin js module. But similar way working fine in desktop. Becoz for web and desktop i have one common kmm module webDesktopCommonMain, and same root component WebDesktopDefaultRootComponent, any idea?
a
did you tried on #decompose channel?
a
I'm not sure, but this looks like a JS compiler bug.
👍 1
You can try changing the code somehow at the mentioned lines, the error may go away. E.g. maybe convert a method reference to a lambda (I had such issues).
s
Thanks @arnaud.giuliani @Arkadii Ivanov this is resolved, due to same named factory classes this was happening, So there were 2 options there for this to solve: First is rename classes in each component to different name rather than same Second one can be to use named dependency injection in Koin. I applied first option here, that makes sense to name Factory classes with component name like HomeComponentFactory etc...
👍 2