Skip to content

ref(events): Migrate ContextIcon to platformicons#115701

Open
priscilawebdev wants to merge 9 commits into
masterfrom
priscilawebdev/ref/de-1262-migrate-contexticon-to-platformicons
Open

ref(events): Migrate ContextIcon to platformicons#115701
priscilawebdev wants to merge 9 commits into
masterfrom
priscilawebdev/ref/de-1262-migrate-contexticon-to-platformicons

Conversation

@priscilawebdev
Copy link
Copy Markdown
Member

@priscilawebdev priscilawebdev commented May 16, 2026

Migrate ContextIcon to render PlatformIcon instead of the legacy
sentry-logos asset map.

This keeps the existing ContextIcon API in place for current callers while
moving the implementation onto platformicons and translating the old
context icon aliases to supported platform ids. It also preserves the
existing unknown-icon sentinel behavior that event context consumers use to
decide when not to render an icon.

closes https://linear.app/getsentry/issue/DE-1262/migrate-contexticon-to-platformicons

Replace the legacy sentry-logos mapping behind ContextIcon with platformicons while keeping the existing component API intact.

Add coverage for alias translation and unknown-icon fallback behavior so follow-up cleanup can safely remove the old asset dependency.

Refs DE-1262
Co-Authored-By: Codex <codex@openai.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 16, 2026

DE-1262

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label May 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 16, 2026

📊 Type Coverage Diff

✅ No new type safety issues introduced. Coverage: 93.53%

Drop the 38 sentry-logos assets only referenced by the legacy ContextIcon mapping and inline the helper logic now that platformicons resolves names directly.
Preserves the prior worker-specific brand from logoCloudflareWorker.
- Return null from getLogoImage instead of a logoUnknown URL sentinel,
  so callers compare against null rather than a build-produced string.
- Pass format=lg to PlatformIcon so shaped device icons (iPhone, iPad,
  Apple TV/Watch, Android phone/tablet, Switch) render their device
  outline instead of just the brand glyph.
- Map google -> google instead of android, restoring the Google logo
  for Pixel devices.
- Bump platformicons to ^9.5.0.

Refs DE-1262
@priscilawebdev
Copy link
Copy Markdown
Member Author

bugbot run

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 920b101. Configure here.


return <img height={size} width={size} css={extraCass} src={imageName} />;
return (
<PlatformIcon platform={platformIconName ?? 'default'} size={size} format="lg" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String size value passed where number expected

High Severity

SvgIcon.ICON_SIZES[providedSize] returns a string like '32px', but PlatformIcon's size prop expects a number. Every other PlatformIcon usage in the codebase passes a numeric value (e.g. size={16}, size={32}). The old code passed this string to an <img> tag's height/width which tolerates strings, but PlatformIcon will not handle '32px' correctly as a numeric size. The value needs to be parsed to a number first (similar to how utils.tsx uses parseInt(iconSize, 10) for UserAvatar).

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 920b101. Configure here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a real bug...it accepts strings too

@priscilawebdev priscilawebdev changed the base branch from master to priscila/chore/bump-platformicons-9.5.0 May 18, 2026 08:09
…ebdev/ref/de-1262-migrate-contexticon-to-platformicons
Base automatically changed from priscila/chore/bump-platformicons-9.5.0 to master May 18, 2026 08:15
@priscilawebdev priscilawebdev marked this pull request as ready for review May 18, 2026 08:23
@priscilawebdev priscilawebdev requested review from a team as code owners May 18, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant