PWA without Route annotation?

Hey guys,

is it possible to have PWA working without a single Route annotation on any view or is it mandatory to have at least one? I switched from using Route annotations to using RouteConfiguration.forApplicationScope().setRoute(). Since then, PWA does no longer seem to be ‘enabled’ (no favicon, no ‘install’ option in the browser). By adding a Route annotation back to any view, it works again, but I’d like to avoid using Route annotations if it’s possible.

It doesn’t seem to work with [dynamic route registration]
( only.


@Route(value = "MyView", layout = MainLayout.class, registerAtStartup = false)
public class ExampleView
    extends VerticalLayout {



…it’s not working.

But with just…

@Route(value = "MyView", layout = MainLayout.class)
public class ExampleView
    extends VerticalLayout {

…it’s working.

So i would guess with the dynamic route registration the parent layout is ‘registered’ too late/in a different way?

This looks like a bug.
I believe the logic doesn’t take into account dynamic routes but checks that there are static routes only.
Please create a ticket.

Hi Martin. I suspect we’ve overlooked the possibility of having only dynamically registered routes and @PWA.

If you see this as an important missing feature, please [create a new issue]

As a workaround, I tried to look if obtaining a ApplicationRouteRegistry with RouteConfiguration.forApplicationScope().getHandledRegistry() and then calling applicationRegistry.setPwaConfigurationClass(myClassWithPwaAnnotation); in a VaadinServiceInitListener would work, but it might be that is too late. You can try this though.

Otherwise you can just add a route with the annotation having a really unlikely URL and maybe have a redirect for it to some other route.

I tried the workaround with applicationRegistry.setPwaConfigurationClass(myClassWithPwaAnnotation);. Unfortunately it does indeed seem to be too late. For now, I will then just stick to a single @Route annotation with an unlikely URL.

Thanks for the feedback. I created a new issue [here]