Hi, I’m trying out Compose Multiplatform Hot Reloa...
# compose-desktop
g
Hi, I’m trying out Compose Multiplatform Hot Reload in a multi-module project. I’ve got a desktop app module that depends on another module. Hot reload works fine when I change code in the desktop module itself. But if I change code only in the dependency module, nothing happens unless I also change the desktop code (e.g. add a line) so the compiler notices. Is there a way to get hot reload to notice changes in the dependent module directly? Or is this just a current limitation?
z
This should already work, actually. You can try it in https://github.com/JetBrains/kotlinconf-app by running the app in the
shared
module and changing code in the
ui-components
module, for example. I believe you need to have the Hot Reload Gradle plugin applied to both modules for now (that should be relaxed later when some changes make it into Kotlin/Compose releases). Maybe you only applied the plugin in your app module?
👀 1
g
Thank you for your reply! I did some checks and found the following: 1. Hot reload works without the plugin in dependent modules. 2. Hot reload doesn’t work for a module located outside the project. 3. (As you mentioned) hot reload works fine for a module inside the project. I confirmed this in this repo: https://github.com/georgeh1998/hot-reload-mm-example In short: Hot reload works when changing code in
shared-hotreloadable
, but not when changing code in
shared-non-hotreloadable
.
Copy code
hot-reload-mm-example/
├── androidApp/
│   ├── app/
│   └── shared-non-hotreloadable/
└── desktopApp/
    ├── composeApp/
    └── shared-hotreloadable/
I realize this is a bit of an edge case, but I’d like to confirm if this is intended behavior of the JetBrains Runtime. (If it is, I’ll check deeper on my side.)
z
That indeed looks like a rare case. cc @Sebastian Sellmair [JB]
thank you color 1
s
I was not quickly able to understand the case, I will investigate the sample project today (or tomorrow). Thank you very much for the reproducer 😍 Generally, its best to have the hot reload plugin available in all modules that you have UI code intended to be reloaded. If absent it will work on 'best effort basis'. Later we will bundle CHR with regular compose, which will make setup trivial
Looking into the project!
I am really puzzled by that setup? Do you share sources across projects by just linking to the same project dir from two builds?
explicit reloads do work; I assume the issue is about Gradles filewatcher. As the subproject is outside of the root of the build, I could see why Gradle can't watch for filechanges, which does not trigger the automatic reload. Launching hot reload from the IDE should work for you as it IDE in the background
Screen Recording 2025-10-08 at 10.11.41.mov