flow
flow copied to clipboard
Vaadin 24.4.alpha25 project gets stuck in an infinite reload loop with VS Code
Description of the bug
When starting a new Vaadin 24.4.alpha25 application in VS Code, it gets stuck in an infinite reload cycle caused by:
Change set: [/Users/mhellber/Desktop/my-app/target/classes [/Users/mhellber/Desktop/my-app/target/classes/META-INF/resources/images/empty-plant.png (MODIFY), /Users/mhellber/Desktop/my-app/target/classes/META-INF/resources/icons/icon.png (MODIFY), /Users/mhellber/Desktop/my-app/target/classes/banner.txt (MODIFY)]]
Running VS Code extension bisect, I could identify the extension causing the issue as the RedHat Java plugin.
Expected behavior
The application should start normally.
Minimal reproducible example
An application downloaded with https://start.vaadin.com/dl?preset=react&preset=partial-prerelease using alpha25.
Starting the app with VS Code running (either by running Application.java or with mvn) causes the app to reload constantly.
Versions
- Vaadin / Flow version: 24.4.alpha25
- Java version: OpenJDK Runtime Environment GraalVM CE 22+36.1 (build 22+36-jvmci-b02)
- OS version: macOS 14.4.1
- IDE (if applicable): VS Code 1.88.1
- Language Support For Java by RedHat VS Code extension version 1.30.0
I couldn't reproduce it.
Tried running the app by running Application.java and mvn.
Also tried disable/enabled the extension, works without restarts.
My configuration:
VS Code Version: 1.88.1 (also tried with 1.87)
Chromium: 120.0.6099.291
Node.js: 18.18.2
OS: Darwin x64 22.3.0
JDK 21
Language Support for Java(TM) by Red Hat v1.30.0
I cannot reproduce this either, with the same setup, except that my operating system is ventura 13.1 i7
I reproduced this case and it stuck in an infinite loop for me as well.
However, after looking at the error logs, I saw some deprecated packages. These changes worked for me:
Change this to latest in package-lock.json:
"@jridgewell/sourcemap-codec": "latest",
(Also check if node.js is installed or not, you can install it from https://nodejs.org/)
After that ensure your versions are up to date using:
npm install -g npm@latest
These steps resolved the issue on my side.
See this temporary solution https://github.com/vaadin/hilla/issues/2573#issuecomment-2237971112
Is this some kind of race condition between VS Code running the Maven "prepare-frontend" target and the dev server running the same thing when you start it? Would it be resolved by removing the eclipse metadata lifecycle metadata for "prepare-frontend"? I think removing that would solve other problems also and make all IDEs behave the same way
Maybe. It doesn't matter if I run the Application.java or mvn. I can start the app without issues from the command line, but the moment I open the directory in VS Code it starts reloading furiously
Infinite reload with IntelliJ - https://vaadin.com/forum/t/continuous-page-reload-while-debugging-using-hotswap/168068 UPD: resolved in 24.5.9.
Tried to reproduce this issue with more current versions today, but was not able to trigger a reload loop no matter how I start the application. Is this still a problem for someone? @marcushellberg could you retest with latest version(s) and report back? If it's still an issue, I'd need more detailed instructions on how to reproduce the issue locally.
Versions I used for testing:
- Vaadin / Flow version: 24.7.0.alpha4
- Java version: openjdk 21.0.5 2024-10-15 LTS
- OS version: macOS 15.1.1
- IDE (if applicable): VS Code 1.96.3
- Language Support For Java by RedHat VS Code extension version 1.38.0
I gave it another try with 24.7.0.alpha8 and 24.6.5 having:
Language Support for Java(TM) by Red Hatversion 1.39.0Debugger for Javaversion 0.58.1- VS Code version 1.97.1
but got no loop.
I wonder if anyone who have this issue could report it to https://github.com/Microsoft/vscode-java-debug/issues or https://github.com/redhat-developer/vscode-java/issues
I just ran into the issue with a fresh start.vaadin.com project with Vaadin 24.6.6 in Cursor. It's happened to me across different laptops, VS Code versions and VS Code-based IDEs like Cursor, and different versions of macOS.
You can try to use
npx upgrade-vaadin - 24.8.nom2e-SNAPSHOT
in a 24.8 project to see if it makes a difference
That seems to have fixed it! 🙌
This issue appears to be similar to #20831, where IDEA is executing Gradle vaadinPrepareFrontendTask on each compilation.
It could potentially be fixed by #21174, as an alternative to removing the Eclipse m2e lifecycle metadata file from the Flow maven plugin.