flow icon indicating copy to clipboard operation
flow copied to clipboard

PWARegistry slows down application startup

Open Artur- opened this issue 2 years ago • 0 comments

Description of the bug

PWARegistry is eagerly initialized in its constructor. This is called on the first request to the server, so in dev mode it happens after the frontend build has completed. The initialization blocks the first request to the server and thus prevents loading the app while icons are being scaled and created.

Running the constructor on my M1 Mac takes 2500ms. This is a significant slowdown and probably takes longer on e.g. older Windows machines

Expected behavior

The initialization should either be run in the background or run the first time a resource is needed. Generating the icons/images cannot block the initial request or other requests, e.g. UIDL. It is fine if e.g. the favicon request waits for the initialization but it cannot disturb development mode startup time.

Minimal reproducible example

npx @vaadin/cli init hello-v232
cd hello-v232
mvn # once to set everything up
mvn # check the time
# Remove @PWA
mvn # check the time to startup

Versions

  • Vaadin / Flow version: 23.2.1

Artur- avatar Sep 22 '22 08:09 Artur-