flow
flow copied to clipboard
Move connection indicator initialization to a shared JS module between Hilla and Flow
Describe your motivation
So far ConnectionIndicator from @vaadin/common-frontend is initialized in Flow.js (the one extracted from jar resources into frontend/generated). Also Hilla has been importing the same and initializing it in the Connect.ts which is used for endpoint calls. vaadin/hilla#3506 introduced a dynamic conditional import for ConnectionIndicator to only initialize it when it is not in the context of the Service Worker, however, that resulted in the vaadin/hilla#3571.
Describe the solution you'd like
As connection indicator is needed regardless of the project type (Flow-only, Hilla-only, or a hybrid), Hilla got rid of its connection indicator initialization, to fix the above issue, relying on Flow to initialize it. This is currently working with the starter projects with React Router due to the having the .withFallback(Flow) in the routes.tsx. If Hilla-only users get rid of the .withFallback(Flow), the connection indicator feature doesn't break.
Let's move the logic for initializing the connection indicator to a client-side module that is loaded regardless of the project type.