Commit db3d901
committed
fix(notifications): never suppress push when clients.matchAll() returns empty
The TTL-gated appIsVisibleFresh fallback was designed to handle the iOS
Safari PWA quirk where clients.matchAll() returns an empty list even
when the app is visually open. In practice, the TTL window (30 s) meant
any push that arrived within 30 seconds of the app being last visible was
silently dropped — including the common case of backgrounding the app
and immediately receiving a reply.
pagehide + visibilitychange together are now much more reliable at
delivering setAppVisible:false before the SW processes the push. When
both events DO fail (iOS kills the JS context mid-event), clients.matchAll()
ALSO tends to return the backgrounded client as visibilityState:'hidden',
which is already handled correctly by the first branch.
The clients.length === 0 path is therefore a triple-failure edge case
where we simply cannot determine visibility. Erring toward showing the
notification (a possible duplicate, handled gracefully by the in-app
banner) is always better than silently dropping it.
Removes appVisibleSetAt, APP_VISIBLE_TTL_MS, and the stale-flag fallback.1 parent a9e8ab9 commit db3d901
1 file changed
+11
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | 15 | | |
23 | 16 | | |
24 | 17 | | |
| |||
578 | 571 | | |
579 | 572 | | |
580 | 573 | | |
581 | | - | |
582 | 574 | | |
583 | 575 | | |
584 | 576 | | |
| |||
758 | 750 | | |
759 | 751 | | |
760 | 752 | | |
761 | | - | |
762 | | - | |
763 | | - | |
764 | | - | |
765 | | - | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
771 | | - | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
772 | 763 | | |
773 | 764 | | |
774 | 765 | | |
775 | | - | |
| 766 | + | |
776 | 767 | | |
777 | 768 | | |
778 | 769 | | |
| |||
0 commit comments