flow icon indicating copy to clipboard operation
flow copied to clipboard

Browser window is opened again on redeploy after a while

Open Legioth opened this issue 1 year ago • 6 comments

Description of the bug

Seems like the new logic with a timeout to avoid re-opening the browser window for each server start is also triggered for redeploys and not only when the server is newly started.

Expected behavior

Expected that the browser opening logic is triggered only when starting the dev server but not when only redeploying an already running server.

Minimal reproducible example

  1. Get a Spring Boot application with Vaadin 24.4 from start.vaadin.com
  2. Start the app, observe that a browser window is opened.
  3. Make a code change, observe that the app is redeployed but no browser window is opened.
  4. Leave the application open for a while (30 min iirc)
  5. Make a code change, observe that a new browser window is opened when the application redeploys.

Versions

  • Vaadin / Flow version: Vaadin 24.4.0.beta5

Legioth avatar Jun 04 '24 10:06 Legioth

This is a known problem as we can't know why the server is running the code or if there is a browser tab open.

The timeout was decided for being ok enough for normal development cycle and can be extended/shortened as needed.

caalador avatar Jun 04 '24 10:06 caalador

I think you miss the point. The previous implementation only did things when the server was started but not for redeploys. The new implementation also does things for redeploys (after the timeout). It shouldn't do anything for redeploys regardless of the timeout.

Legioth avatar Jun 04 '24 11:06 Legioth

It should work the same as before and return the system property value if time has run out since file creation. The only thing added was the don't check system property if file created before timeout https://github.com/vaadin/flow/blob/b23c0b76972efab61ad03149ac936e25df0c0476/vaadin-dev-server/src/main/java/com/vaadin/base/devserver/BrowserLauncher.java#L74

Need to be investigated.

caalador avatar Jun 04 '24 12:06 caalador

The logic seems solid. Maybe I was actually restarting the server without realizing it? Will try to remember to leave it running over lunch again and see if it reproduces.

Legioth avatar Jun 05 '24 07:06 Legioth

Can't reproduce now. Must have been a fluke.

Legioth avatar Jun 05 '24 09:06 Legioth

Happened again now and this time I'm certain I didn't restart the server. But I also don't have any additional clues on what goes on here.

Legioth avatar Jun 11 '24 10:06 Legioth