-
-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"This site has been updated in the background" #1836
Comments
I had something like this on Safari during tests and the culprit was this if (!payload) return // ignore push events without payload, like isTrusted events At every onPush event there's an isTrusted that gets passed to it, signaling that the notification is permitted by the user and/or the site is valid. This was here on early code too, but if we don't return at empty payload we would get an empty isTrusted notification at every onPush. |
If it happens only on "stacked" notifications we can think that event.waitUntil isn't really extending the time and the onPush event concludes earlier than expected.
To reply to this, yes they have to have some payload, in case of isTrusted the payload is empty because it's the browser's job to handle it |
I also received it with a "X has replied to a post" notification (user subscription). It also only happens ocassionally.
Mhhh, but the documentation mentions the purpose of
I looked at the stacker.news/sw/eventListener.js Lines 60 to 64 in 355abc7
I think this should be this: diff --git a/sw/eventListener.js b/sw/eventListener.js
index 0e8b6778..fcec05be 100644
--- a/sw/eventListener.js
+++ b/sw/eventListener.js
@@ -59,7 +59,7 @@ export function onPush (sw) {
// iOS requirement: wait for all promises to resolve before showing the notification
event.waitUntil(Promise.all(promises).then(() => {
- sw.registration.showNotification(payload.title, payload.options)
+ return sw.registration.showNotification(payload.title, payload.options)
}))
}
} So I think it's more likely that the service worker is still running after the browser considered it already done. That's why the silent push warning shows up first before I see the actual notification. I think that means the service worker is not terminated immediately but still had some time to show the notification 🤔
Do you mean the browser triggers |
That what I thought, too. But if you remove the empty payload 'filter' you'll get isTrusted notifications |
Is there an existing issue for this?
Describe the bug
Yesterday and just now, I got "This site has been updated in the background" as a push notification on my laptop running NixOS and Brave.
Screenshots
Steps To Reproduce
???
Expected behavior
Never receive "this site has been updated in the background"
Logs
No response
Device information
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: