Fix: Push notifications error on unsupported browsers#868
Closed
sentry[bot] wants to merge 1 commit into
Closed
Conversation
Contributor
|
Contributor
Deploying with
|
| Status | Preview URL | Commit | Alias | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! | https://pr-868-sable.raspy-dream-bb1d.workers.dev | e9dbda2 | pr-868 |
Tue, 19 May 2026 10:47:06 GMT |
Member
|
PR by sentry? huh? |
Member
|
bad bot at the very least pr opener needs to be human |
Member
Yeah would be preferable lol |
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.
Description
This PR addresses the unhandled error "Push messaging is not supported in this browser." (SABLE-TQ) that occurred when
enablePushNotifications()was called on browsers lackingserviceWorkerorPushManagerAPIs.Root Cause:
togglePusher()function, invoked on everyvisibilitychangeevent, calledenablePushNotifications()without first checking for browser push notification capability.enablePushNotifications()would then throw an unhandled error if the necessary browser APIs (serviceWorker,PushManager) were absent.usePushNotificationssetting could be enabled (and defaulted totrueon mobile) even on browsers that do not support push notifications (e.g., DuckDuckGo, Safari iOS, Firefox iOS), leading to repeated errors.Changes Made:
isPushSupported()utility: A new helper functionisPushSupported()was added toPushNotifications.tsxto check for the presence ofserviceWorkerandPushManagerAPIs.togglePusher():togglePusher()now performs an early return if!isPushSupported(), preventing calls toenablePushNotifications()on unsupported browsers and eliminating the repeated errors on visibility changes.enablePushNotifications(): TheenablePushNotifications()function now returns gracefully instead of throwing an error when push is unsupported, providing a defense-in-depth mechanism.usePushNotificationsinsettings.tsnow includes a check forisPushSupported(), ensuring that the setting is not enabled by default on unsupported browsers.SystemNotification.tsxis now hidden if the browser does not support push notifications, improving the user experience by not presenting unavailable features.Fixes SABLE-TQ
Type of change
Checklist:
AI disclosure:
Fixes SABLE-TQ