Bug
Push notifications are being sent even when the user is actively looking at the app. If the user has the app open and visible (tab is in the foreground, app is online), push notifications should be suppressed entirely — they are redundant and disruptive.
Expected behavior
- Push notifications should only be delivered when the user is not looking at the app — i.e., the tab/window is hidden, the app is in the background, or the client has gone offline.
- If the user is online and the app tab is visible (
document.visibilityState === 'visible'), do not send or display a push notification.
Steps to reproduce
- Open the app and keep it in the foreground.
- Trigger any action that generates a push notification (e.g., agent reply, alert).
- Observe that the push notification fires even though the user is actively viewing the app.
Fix
- On the client side: before registering or displaying a push notification, check
document.visibilityState and the online status. If the page is visible and online, suppress the notification.
- On the service worker / backend side: consider passing a presence/visibility signal so the server can skip sending the push payload when the client is known to be active.
- Gate the push delivery on:
document.visibilityState !== 'visible' || !navigator.onLine.
Bug
Push notifications are being sent even when the user is actively looking at the app. If the user has the app open and visible (tab is in the foreground, app is online), push notifications should be suppressed entirely — they are redundant and disruptive.
Expected behavior
document.visibilityState === 'visible'), do not send or display a push notification.Steps to reproduce
Fix
document.visibilityStateand the online status. If the page is visible and online, suppress the notification.document.visibilityState !== 'visible' || !navigator.onLine.