Repository navigation
fix: [SDK-5120] inline the icon unless it is the notification image - #1561
Merged
Merged
Conversation
The worker skipped the inline path for any push with an image when the icon was not the stored app default icon. That check failed when the device had no stored default icon or when the payload icon did not match the app config. Compare the icon with the image instead, so only the server-set image icon on Chrome for macOS passes through as a URL.
abdulraqeeb33
approved these changes
Nov 6, 2026
abdulraqeeb33
left a comment
Contributor
There was a problem hiding this comment.
The icon is inlined unless it is the notification image. The comparison runs after both URLs are rewritten to HTTPS, so an icon the server set to the image still matches. A missing icon still falls back to the stored default, and that default no longer decides the inline path.
The new tests cover a distinct icon and a device with no stored default. The image URL is not fetched in those cases.
fadi-george
approved these changes
Nov 6, 2026
fadi-george
left a comment
Contributor
There was a problem hiding this comment.
LGTM, a couple of non-blocking notes inline.
Merged
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.
Description
1 Line Summary
Inline the notification icon unless the icon is the notification image. Follow-up to #1531.
Details
#1531 inlines the icon so Chrome on Android does not show the grey "W" placeholder when the icon fetch fails. For a push with an image, the worker only inlined the icon when it was equal to the stored app default icon (
Options.defaultIcon). That check skipped the inline path in 3 cases:Options.defaultIcon. Only a page load writes that record, so a device that did not open the site since the release never inlines an icon on a push with an image.defaultIconUrldiffer in any character.chrome_web_icon. The icon is a real icon, not the image, and it was passed through as a URL.The Sun sends most pushes from a template with a global image, so the reports in SDK-5120 that continue after the
160700release fall in these cases.The intent of the check was Chrome on macOS, where the server sets the icon to the notification image. This change asks that question directly: the icon passes through as a URL only when it is equal to
notification.image. Everything else is inlined.Options.defaultIconstill fills in a missing icon, but it no longer decides the inline path.Known limit: if the macOS payload drops
imageafter the server sets the icon to the image URL, the worker tries to inline that URL. The current code onmaindoes the same in that case.inlineImagehas a 5 s timeout and a 128 KB cap, so a large image falls back to the remote URL.Systems Affected
Validation
Tests
Info
vp test src/sw/serviceWorker/ServiceWorker.test.ts src/sw/helpers/inlineImage.test.ts: 59 passed.vp check: 0 errors. The 7 warnings are inOneSignal.test.tsand exist onmain.vp run build:prod: size-limit passes. Worker bundle 13.06 kB (limit 13.1 kB), page bundle unchanged.Test changes in
ServiceWorker.test.ts, under "with the flag and a large image":Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
Not needed. The change is a 1 line condition in the worker with unit tests for each branch.
Checklist
Related Tickets