Hi,
When there’s no @PWA
in the application (in main layout or view) flow doesn’t generate sw.js
(it’s no needed), but some part of flow requests it on every route (page) navigation. It generates unnecessary server requests, even generates 2 threads on web server (I’ve checked it) - for each single page request! Because sw.js is not present this second request is rerouted to com.vaadin.flow.router.RouteNotFoundError
(you can check it by implementing BeforeEnterListener.beforeEnter
).
I’ve found it because this behavior spoils my security mechanism (there’s unplesent effect of browser being refreshed twice).
I found workaround for this- placing empty sw.js in webapp folder.
Checked on:
- Vaadin Flow 13.0.7
- JDK 1.8
- Firefox 67.0
You can test this bug by doing this:
- get Base Starter for Vaadin Flow (i’ve got with Spring)
- implement BeforeEnterListener, place syso in beforeEnter to check what navigationTarget and location is requested
- with @PWA you’ll get one route request on every page request
- comment @PWA in MainView, rerun the app
- with no @PWA yul’ll get two route requests (MainView and sw.js → RouteNotFoundError)
I attached my simple app.
If it’s a bug please make a ticket.
Best regards,
17689563.zip (49 KB)