With Compose Hot Reload now being available on Mav...
# compose-desktop
s
With Compose Hot Reload now being available on Maven Central, I would be looking heavily for feedback: https://github.com/JetBrains/compose-hot-reload/releases/tag/v1.0.0-alpha01 Especially: • Issues you experienced when setting it up • Issues when reloading particular pieces of code • Ideas on how to improve/feature requests Less Interesting at the moment: • Build Performance: Right now the 'Gradle Recompiler' will be as fast as your project. It is highly recommended to enable Gradles Configuration Cache and keep your project very clean. There will be other 'recompilers' which will help! (IntelliJ, Amper, ...)
K 21
a
@Sebastian Sellmair [JB] is it a matter of adding the plugin and enabling the compiler feature and that's it or am i missing something?
2
c
i will give this a shot today since i'm in the middle of active development on my side project and ill let you know of any issues!
for anyone that doesn't know the origins of hot reload. behold:

https://www.youtube.com/watch?v=8Z-Vuo3wTd0

where Seb was "just thinking of new topics to create videos on" lmao. from brainstorming video ideas to achieving something lots of smart people thought wasn't possible. @Sebastian Sellmair [JB] is 🐐
thank you frog 1
s
Yep, so the necessary steps: • Use Kotlin 2.1.20-RC (or any higher if released) • Apply the plugin • Wrap the content of a window with
DevelopmentEntryPoint {}
• Use OptimizeNonSkippingGroups (optional, but a better experience for me). Then in a KMP project and IntelliJ, just using main function run gutter to run the APP. If you're using Kotlin JVM or Android Studio, then configure the jvmRun task or provide ./gradlew jvmRun -DmainClass=path.toMain.MainKt ^ Basically, running compose apps is the easiest if using KMP + IntelliJ. But the Readme shows multiple other ways of launching it
😍 1
And 30 min after writing this instruction I noticed how unhappy I am with the remaining complexity of 'just running the app'. I'll talk to the teams involved to see what ways we have to making this as easy as universally just pressing 'run'
m
I've tried to use it 2 days ago, spent over an hour fighting it and gave up due to it either causing my app to fail to build with what looked like weird compiler cache errors, or just not work at all even when it builds. I would love this to work but I couldn't get it to work.
s
@Marcin Wisniowski: I would be very interested in your project setup to see where the friction lies
@Marcin Wisniowski Maybe we could meet (Google Meet) sometime next week and I offer help? You might be able to play around with it (if we succeed) and I get to experience the friction and problems and can think of ways of making the setup easier 💪
m
@Sebastian Sellmair [JB] Sure, I'd be glad to help (and be helped).
s
kodee happy ! Ill DM you to find a time that suits us both!
^ For anyone reading! If you also struggle to set this up, then I am happy to help and learn about all friction points. Don't be shy reporting that you experienced an issue or failed to setup the plugin!
u
I personally tried it, I installed it in 3 minutes, and it's impressive how well it works and it's so much more practical than the previews! Thank you very much
thank you color 1
I think most android devs don't know what it means to use jetbrains jdk, and it's a shame in the readme not to explain how to use it via intellij, it's much simpler
🤜 1
🤛 1
s
Really Good Idea! Can be installed by IntelliJ; Acutally, with an IntelliJ plugin we could just use the JVM that is shipped with IntelliJ so no download necessary think smart
Anyways, the readme should mention that, I agree!
K 1
a
@Sebastian Sellmair [JB] I just tried it out. It takes around 6 seconds to see any updates changes, which is the same time to rebuild my project. Still valuable since I find the killing of the app window and showing it again disorienting when doing UI work. Didnt do any real UI work yet tho.
s
@Alex Styl: Thats not unsurprising as your Gradle project is used as 'recompiler'. Have you tried to enable Gradles configuration cache and potentially looked into why your build might take 6 seconds for incremental updates? As I mentioned: Build Times will be tackled by Amper and or later stages of the project (where we take care of cutting down the time it takes from your Gradle build)
u
It takes me 2-3 seconds to see any updates changes
s
2-3 seconds is not bad! I would say that everything below 1s becomes really enjoyable 🙇
g
> it's so much more practical than the previews It depends what you develop, I don't have any problem with preview as soon as I work with UI, not with business logic
u
I also have no problem with previews, it works very well, but hot reload is just better
g
It still depends how fast is building on real app Anyway, also very excited for hot reload, just feel that it will be helpful for business logic changes, rather than compose UI itself
s
I agree: There are different workflows and preview vs hot reload have different characteristics, pros and cons. Ultimately, Compose should offer a set of tools to pick from and in the end the development experience shall be smooth, quick and productive 🙂
👍 1
c
@Sebastian Sellmair [JB] I was finally able to try hot reload! I followed the intructions in the readme. A few things (some are nitpicky... sorry!) 1. It wasn't clear where to add
Copy code
composeCompiler {
    featureFlags.add(ComposeFeatureFlag.OptimizeNonSkippingGroups)
}
root build.gradle? or composeApp build.gradle? 2. I didn't include
Copy code
plugins {
    id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
and everything still worked fine. i did change my gradle jdk to the JBR that comes included in intellij. 3. According to "Optional: Create a custom entry point to launch your hot application" and FAQ
My project is a desktop-only app with Compose Multiplatform. Can I use Compose Hot Reload?
Yes! However, please note that you can't start the application via the run button in the gutter (CMP-3123). Instead, use the custom Gradle task as described above. so. according to that. I can't use the run button in the gutter and need to add a custom task... but I did run it via the gutter and hot reload works!!! TL;DR It seems like a bunch of steps aren't needed. So really for the setup I just added the plugin and wrapped my app code, and added that feature flag. and ran from the gutter. and that's it. Let me know if I should actually add foojay-resolver or add the run task.
m
but I did run it via the gutter and hot reload works!!!
Interesting, it doesn't work for me unless I use the Gradle task
s
Thanks Colton 🙇 I think the issue here is that all of those things are pretty 'it depends' kind of issues. Therefore requesting the 'more safe option' is likely a good starting point. However, I really would like to make it "just apply the plugin and be happy"
❤️ 1
161 Views