flow icon indicating copy to clipboard operation
flow copied to clipboard

Vaadin 24.4.alpha25 project gets stuck in an infinite reload loop with VS Code

Open marcushellberg opened this issue 1 year ago • 3 comments
trafficstars

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. Screenshot 2024-04-25 at 11 43 58

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

marcushellberg avatar Apr 29 '24 19:04 marcushellberg

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

mshabarov avatar Apr 30 '24 06:04 mshabarov

I cannot reproduce this either, with the same setup, except that my operating system is ventura 13.1 i7

manolo avatar Apr 30 '24 07:04 manolo

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.

AlainaFaisal avatar Jun 14 '24 06:06 AlainaFaisal

See this temporary solution https://github.com/vaadin/hilla/issues/2573#issuecomment-2237971112

codercodingthecode avatar Jul 19 '24 02:07 codercodingthecode

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

Artur- avatar Dec 11 '24 07:12 Artur-

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

marcushellberg avatar Dec 18 '24 22:12 marcushellberg

Infinite reload with IntelliJ - https://vaadin.com/forum/t/continuous-page-reload-while-debugging-using-hotswap/168068 UPD: resolved in 24.5.9.

mshabarov avatar Jan 07 '25 07:01 mshabarov

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:

tepi avatar Jan 14 '25 12:01 tepi

I gave it another try with 24.7.0.alpha8 and 24.6.5 having:

  • Language Support for Java(TM) by Red Hat version 1.39.0
  • Debugger for Java version 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

mshabarov avatar Feb 12 '25 12:02 mshabarov

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.

marcushellberg avatar Mar 03 '25 22:03 marcushellberg

You can try to use

npx upgrade-vaadin - 24.8.nom2e-SNAPSHOT

in a 24.8 project to see if it makes a difference

Artur- avatar Mar 04 '25 06:03 Artur-

That seems to have fixed it! 🙌

marcushellberg avatar Mar 04 '25 16:03 marcushellberg

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.

mcollovati avatar Mar 24 '25 07:03 mcollovati