I love kmp wasm but there is one annoying thing - ...
# webassembly
a
I love kmp wasm but there is one annoying thing - texts on buttons are loading not instantly and with weird animations. Is that going to be fixed? 😅 See example in thread.
Screen Recording 2025-09-23 at 12.10.46.mov
w
This is just how web works. The resources files are fetched async and then Compose is notified when they're loaded. If you want to avoid the pop-in, you need to manually block until the resources file is ready, and ideally cache it manually to avoid the browser deciding when the file is cached. There's also prefetch APIs to load specific resources.
a
why it doesn’t work like this in raw web? Because of cache? Maybe can be fixed on kmp wasm side? 🥺
g
I really think it depends how resources are loaded in your case. If it a separate file and not a part of code, you need to wait for them
Maybe you have a link on your app, I'm curious to in terms of network access
a
it’s just normal KMP app and I don’t do any resource management. 😄 Link to app: https://app.myaiphotoshoot.com/ Link to code: https://github.com/Andoctorey/myaiphotoshoot-kmp
p
Here is you calling stringResource: https://github.com/Andoctorey/myaiphotoshoot-kmp/blob/75a7f98118935f1b82f5237954bb2fca0405b9d7/composeApp/src/commonMain/kotlin/ai/create/photo/ui/main/MainScreen.kt#L78 And here is stringResource function declaration: https://github.com/JetBrains/compose-multiplatform/blob/85fb7589e9f45c23c4c5d24cb2d5f4c11b600fca/components/resources/library/src/commonMain/kotlin/org/jetbrains/compose/resources/StringResources.kt#L25 stringResource is the Composable function that initialy return emptyString and for web target use async call for getting resource in some LaunchedEffect if go deeper in its impl.
a
good idea but imho over-engineering and will make code ugly. I will better wait for wasm in release. thank you anyway.
g
why is it overengineering? Probalby it's just a matter to fetch any resource before your app using it. I don't think it should be all strings. Just a matter to ensure it's loaded immediately, same as with images for example This problem is not new, for example for all cases when websites use font-based icons