Files
2026-09-09 11:50:00 +02:00

1.4 KiB

PWA push receiver

The custom src/main/frontend/sw.ts retains the generated Vaadin worker's offline fallback, runtime-resource precache and connection-state reporting. Its push handlers are replaced by the tested push-worker.js module. This follows Vaadin's custom service worker mechanism.

Incoming notifications use the journal icon and a stable per-day tag. Clicking closes the notification and navigates an existing application window to the dated Work form, or opens a new window when necessary. Destinations must match the application's origin and scope, the Work route, a real ISO date and new=true; external URLs, fragments and invalid dates are rejected. Malformed payloads do not cause an uncaught JSON error. Push event completion waits for notification display.

Frontend tests cover display, invalid payloads and URLs, scope-relative routing, and reuse/new-window behavior. The production build forces frontend generation because Vaadin's optimized reuse initially retained the default worker despite the custom source. The production smoke test now requests /sw.js and verifies that the application-specific receiver was actually packaged and served.

This prepares receipt and clicks. Browser opt-in, real device delivery and return to a dated form after a fresh login remain acceptance/integration work.