Repository navigation
Push receiver: read the declarative notification from the push event (Safari history fix) - #179
Merged
Merged
Conversation
…(Safari history fix) On an iPhone the pushes arrived with the right content, but every history entry was the generic placeholder: with "mutable": true Safari (iOS >= 18.4) dispatches the regular push event with the proposed Notification in event.notification and event.data null, and the worker read only event.data. The push handler now takes event.notification first and shows the same content itself (one notification, entry written at arrival); a tap on a notification the platform displayed without the worker rebuilds the entry from the Notification's data, and the click path's history write is bounded like the push path's. Tests pin both paths. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Problem
First device test (iPhone, iOS 18.4+): pairing, the test push and the session-watch push all arrived with the right title and body, but every entry in the receiver's history was the generic placeholder ("Autopilot Monitor / New alert", type
unknown, no link).Cause: with
"mutable": trueSafari dispatches the regularpushevent with the proposedNotificationinevent.notificationandevent.datanull (Push API draft). The worker read onlyevent.data, got nothing, and stored the fallback entry.Fix (web only,
public/push/sw.js)pushhandler readsevent.notificationfirst and shows the same content itself, so exactly one notification appears and the history entry is written at arrival. Other browsers still hand the raw JSON asevent.data.data(same normalizer), so the history is complete either way.lib/__tests__/pushSw.test.ts).Verification
Web vitest,
tscandeslintgreen; see the CI run. Device check after deploy: open the receiver app, trigger a test push from Alerts › Push devices, the history entry must show title, body, facts and the portal link, and only one notification should appear on the lock screen.🤖 Generated with Claude Code