Hello everone and a friendly good morning from ger...
# javascript
z
Hello everone and a friendly good morning from germany! right now i'm fighting with some wierd crashes in my kotlin react app, caused by asynchrounous loading a json with
GlobalScope.launch{}
via the
componentDidMount
while loading a child-component. In 1.3.72 it worked like a charmer, are there any known bugs in 1.4.10 that i missed?
t
Do you use
legacy
mode?
z
If legacy is the default then yes.
i didn't configure the new IR Compiler
b
@zeugederunity have you updated libraries too?
Do you have a simple project to reproduce?
z
I dont have a simple project, i'll tinker one together. Any my libraries are:
Copy code
// Kotlin JS
val kotlin_react_version = "16.13.1-pre.116-kotlin-1.4.10"
val kotlin_react_router_dom = "5.1.2-pre.116-kotlin-1.4.10"
val kotlin_styled_version = "5.2.0-pre.116-kotlin-1.4.10"
Copy code
val kotlin_coroutines_version = "1.3.9"
Okay, i just realized that this isn't a coroutine but serialize problem, seems like the code crashes when it reaches the
Json.decode()
thing.
Ok, i was wrong. The cause of the script crash isn't the coroutine, it is the custom serializer in the commons library. But it works fine in the JVM.
b
cc @sandwwraith
z
Here is a git reposirtoy with a "working" minimal project: https://github.com/FelixEngl/MPPSerialisationJSFail
@bashor @sandwwraith If you try this code please note that the script does not crash, therefore you won't get any error/exception/whatsoever. I just updated the readme regarding this.
I submitted an issue in the serializer reopsitory: https://github.com/Kotlin/kotlinx.serialization/issues/1086
🙏 1
s
Thanks, I'll take a look
z
I had some time to play around with the code, seems like kotlin has a problem with handling the break in the when statement. When you add a label to it, the code works.
@bashor Update: I don't know if you got the message, but I found the bug. The kotlin JS-compiler doesn't handle a break in a when correctly when there is no label. In which Repository should i post this problem?
b
@zeugederunity please file an issue here kotl.in/issue
🙏 1
z
@bashor sorry for the interruption, but how did you get that clean compiled JS output in your response of the issue? Did you clean it up yourself or are there some features in the compiler didn't know?
b
@zeugederunity it was from play.kotl.in, there is a shortcut to show generated JS (
Ctrl + J
for macOS). You can look at all shortcuts by clicking on question mark on right side.
Locally you can fin raw compiler output by path like:
build/js/packages/<module-name>/kotlin/
🙏 1