Repository navigation
fix(frontend): surface service worker registration failures - #431
Merged
Merged
Conversation
) The registration path hid failures from developers and monitoring. Report them properly while keeping the app working without a service worker: - failures are logged with `console.warn` and sent through a new `reportError` seam (`app/lib/monitoring.ts`) that forwards to a monitoring service when one is attached to `globalThis` (Sentry-compatible or `window.__AIRFLEX_MONITOR__`), and is a safe no-op otherwise; - a development-mode warning explains *why* registration was skipped (production-only; next-pwa emits `/sw.js` only in production builds); - an environment without `navigator.serviceWorker` warns and degrades gracefully instead of throwing. Note: the catch was not literally empty on `main` (it logged via `console.error`); this implements the issue's asks — `console.warn`, monitoring forwarding, and a dev-mode explanation. Closes arflexx#285
|
@Zuliyat Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #285
Service worker registration failures were hidden from developers and monitoring. This surfaces them without breaking graceful degradation.
Changes
app/lib/monitoring.ts— a minimal, no-throwreportError(error, context)seam. Logs locally and forwards to a monitoring service if one is attached toglobalThis(Sentry-compatible orwindow.__AIRFLEX_MONITOR__); safe no-op otherwise; SSR-safe.components/ServiceWorkerRegister.tsx:console.warn+reportError(err, { source: "service-worker" })./sw.jsonly in production builds).navigator.serviceWorkerwarns and degrades gracefully instead of throwing.Note on the premise
maindid not have a literally empty catch — it already calledconsole.error. This PR implements the issue's actual asks:console.warn, forwarding to monitoring when available, and the dev-mode explanation.Tests (
components/ServiceWorkerRegister.test.tsx) — 4 passednavigator.serviceWorker→ nothing registered, no throw.registerrejects →console.warncalled,reportErrorinvoked, no throw.registerresolves → no warning.