Fix: Masterbar Horizon crash from string icon in createInterpolateElement#109905
Merged
Fix: Masterbar Horizon crash from string icon in createInterpolateElement#109905
Conversation
Wrap string icons in Gridicon, matching item.tsx approach.
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
Contributor
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
fushar
approved these changes
Apr 9, 2026
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.
Proposed Changes
MasterbarLoggedIn, wrap the result ofwordpressIcon()in aGridiconwhen it returns a string, mirroring the approach used inclient/layout/masterbar/item.tsx(line 102).Rather than a broken button label, we now have this. It doesn't look great. But it wasn't working at all before.
Why are these changes being made?
wordpressIcon()returns the string'my-sites-horizon'instead of an SVG element. Since Masterbar: migrate from localize HOC to @wordpress/i18n #109489 migrated this code fromi18n-calypso'stranslate()(withcomponents) to@wordpress/element'screateInterpolateElement, that string crashes the render:createInterpolateElementrequires every value in the conversion map to be a React element, while the oldtranslate()was forgiving and accepted strings. The bug was arguably latent before — the code only ever happened to pass elements — but the stricter API surfaced it on Horizon.item.tsx, which already handles it withtypeof icon !== 'string' ? icon : <Gridicon icon={ icon } size={ 24 } />. This PR uses the same shape for consistency.Testing Instructions
hostname === 'horizon.wordpress.com') and confirm it renders without crashing and the WordPress.com account icon shows.Pre-merge Checklist