feat(notifications): fixing pwa notifications being repeated#44
Merged
prathameshkurunkar7 merged 2 commits intoApr 17, 2026
Merged
Conversation
…on and improve data merging for FCM messages
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.
Identified the issue after so so long -
This is a well known issue in the community, it's just that fix was not so simple without breaking anything else.
https://stackoverflow.com/questions/66697332/firebase-web-push-notifications-is-triggered-twice-when-using-onbackgroundmessag#:~:text=3%20Comments&text=If%20you%20using%20Firebase%20Admin,send%20some%20data%20like%20below.&text=With%20FCM%2C%20you%20can%20send,property%20notification%20from%20the%20payload.&text=With%20that%2C%20FCM%20will%20not,doesn't%20has%20property%20notification%20.
https://firebase.google.com/docs/cloud-messaging/web/receive-messages
firebase/firebase-js-sdk#6670
So when the payload has both notification + data:
FCM's built-in push handler auto-displays the notification on the browser.
The Raven web SW's onBackgroundMessage fires and (based on the duplicate you're seeing in the screenshot) also calls self.registration.showNotification(...).
User sees two notifications — one from FCM's default handler, one from the custom SW.
But we can't simply remove notification as APNS and Android both have different configuration from web.
Requires a small but probably breaking change on client as well - The-Commit-Company/raven#2126