{
  "id": 2506148,
  "title": "The Optimization That Was Too Good: Why Our Push Notifications Only Worked When You Weren't Looking",
  "url": "https://urgent.news/2026/08/22/the-optimization-that-was-too-good-why-our-push-notifications-only",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-22T05:19:16.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/dj29/the-optimization-that-was-too-good-why-our-push-notifications-only-worked-when-you-werent-looking-2f4d"
  },
  "original_language": "en",
  "account": "The push notification system for ShelfTalk, a real-time social app, accidentally functioned optimally only when users weren't actively using the app. The developer, JaniDhruv, implemented a brilliant optimization to prevent desktop notifications from appearing while a user was actively reading a message. However, this optimization failed to account for scenarios where the ShelfTalk tab remained visible on a second monitor, even when the user was working on another application. Consequently, important notifications, such as direct messages and group mentions, were being missed by users who had the ShelfTalk app open on a secondary monitor while focusing on other tasks. The issue arose because the Page Visibility API (document.hidden) only returned true when the page was completely hidden, either behind other windows or minimized. If the tab was visible on a second monitor, document.hidden was false, and the notification still fired. Users left on their main screen were completely unaware of the missed notifications, and even users at home working on another device would miss messages if their office machine was still actively looking at the ShelfTalk app.",
  "summary": "This is a submission for DEV's Summer Bug Smash: Smash Stories powered by Sentry . When I was building the push notification system for ShelfTalk — a real-time social app that won the GitHub Finish Up A Thon Challenge on DEV — I wanted to be considerate of my users. There's nothing more annoying than actively chatting in a web app and having your desktop ping you with a notification for the exact…",
  "key_points": [
    "Push notification system optimized for inactive users",
    "Optimization missed notifications on secondary monitor",
    "Page Visibility API failed to hide notifications"
  ],
  "editors_take": "The optimization highlights a limitation in the Page Visibility API, showing it does not accurately capture all scenarios where a user is not actively engaging with a tab.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}