Has anyone tried running Auto-Reload feature with ...
# ktor
s
Has anyone tried running Auto-Reload feature with HTMX or staticResources? For some reason it is not working for me. It catches the changes, but then the web-app is not working, even though Java process is still running. I'd need to debug it albeit more to find the culprit, but I wonder if someone had this issue? With "normal" Ktor server it is working fine. Only with HTMX setup it isn't
s
Thank you, will follow the issue!
a
Which version of Ktor do you use?
s
3.2.3
a
Then it shouldn't work at all because of the regression.
👍 1
s
The issue happens in this repo too: https://github.com/anderssv/kotlin-htmx Although, I don't see any errors. As I said, didn't debug more, but something might be off Just it is not auto-reloading. With non-staticResource projects auto-reloading works fine
a
I had 2 issues, as reported in the issue: • embeddedServer -> autoreloading not working at all, EngineMain works fine • staticResources not working at all, after a reload they are not found So, with non-static Resources it can be true that it does work, as long as you use EngineMain
👍 1
🙏 1
h
Usually reload for me doesn't rebind to the address 🫠
s
I wonder if it would be feasible to adapt same solution from
compose-hot-reload
with DCEVM to Ktor JVM? Sadly, it would be only for JVM, but I believe Ktor-Server is mostly ran in JVM? Checked Ktor code and some logic for Auto-Reloading dates back to 2015
a
@skominas.ainis, we already have plans for this.
❤️ 3
s
Oh, that's very nice. Good to see that!
One more thing regarding
staticResources
is that if I add a new file (e.g. image) or edit an existing
*.css
file for example I need to do a full rebuild to have it reflect the change. Maybe I am doing something wrong?
a
The auto-reloading is expected to work if you edit an existing resource.
s
Okay. I might be doing something wrong, but neither auto-reload or running a new Ktor instance work. Only full rebuild reflects new changes. I'll try to come up with a reproducible build if possible
a
Can you try version 3.1.3 of Ktor?
s
Not really, as I am using HTMX which was not available at 3.1.3 EDIT: I can, one sec, will see if it works
a
If you use Ktor 3.2.0 or above, then it's the regression filed in KTOR-8821.
👍 1