Repository navigation
refactor(icons): migrate components from useXDSIcon to getIcon - #531
Merged
Merged
Conversation
Replace all component-level useXDSIcon() calls with getIcon() from the global icon registry. This removes the React Context dependency for icon resolution, making icons work in both server and client environments. Changes: - XDSIcon: use getIcon() instead of useXDSIcon() - XDSCollapsible: use getIcon() instead of useXDSIcon() - XDSMoreMenu: use getIcon() instead of useXDSIcon() - XDSTheme: remove IconRegistryContext.Provider wrapper, keep registerIcons() - IconRegistry: deprecate useXDSIcon and IconRegistryContext with JSDoc - globalIconRegistry: update docs to reflect it's the single icon path - Icon/index.ts: mark deprecated exports with JSDoc
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsCollapsible · View in Storybook
Icon · View in Storybook
MoreMenu · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 1 accessibility violation(s) found — 1 serious. XDSIcon - 1 issue(s)
Component PreviewsIncludes interactive hover previews as animated GIFs. XDSCollapsibleSingle Mode (default)Screenshot: Interaction Preview: (view video) View in Storybook · Standalone CollapsibleScreenshot: View in Storybook · XDSIconXDSMoreMenuGenerated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
pushed a commit
that referenced
this pull request
Mar 8, 2026
BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs. Removed: - XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps) - XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps) - useXDSIcon hook (use getIcon from globalIconRegistry) - IconRegistryContext (use registerIcons + getIcon) - IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx) - getGlobalRegistry internal helper (no longer needed) Added: - migrate-useXDSIcon-to-getIcon codemod with 11 tests - Updates internal imports from IconRegistry to globalIconRegistry Migration codemods exist for all removed APIs: - rename-topnav-title-to-heading (PR #530) - rename-sidenav-header-to-heading (PR #530) - migrate-useXDSIcon-to-getIcon (this PR) Refs: #527, #530, #531
cixzhang
added a commit
that referenced
this pull request
Mar 8, 2026
….2 (#533) BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs. Removed: - XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps) - XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps) - useXDSIcon hook (use getIcon from globalIconRegistry) - IconRegistryContext (use registerIcons + getIcon) - IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx) - getGlobalRegistry internal helper (no longer needed) Added: - migrate-useXDSIcon-to-getIcon codemod with 11 tests - Updates internal imports from IconRegistry to globalIconRegistry Migration codemods exist for all removed APIs: - rename-topnav-title-to-heading (PR #530) - rename-sidenav-header-to-heading (PR #530) - migrate-useXDSIcon-to-getIcon (this PR) Refs: #527, #530, #531 Co-authored-by: navi[bot] <[email protected]>
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
Replace all component-level useXDSIcon() calls with getIcon() from the global icon registry. This removes the React Context dependency for icon resolution, making icons work in both server and client environments. Changes: - XDSIcon: use getIcon() instead of useXDSIcon() - XDSCollapsible: use getIcon() instead of useXDSIcon() - XDSMoreMenu: use getIcon() instead of useXDSIcon() - XDSTheme: remove IconRegistryContext.Provider wrapper, keep registerIcons() - IconRegistry: deprecate useXDSIcon and IconRegistryContext with JSDoc - globalIconRegistry: update docs to reflect it's the single icon path - Icon/index.ts: mark deprecated exports with JSDoc Co-authored-by: navi[bot] <[email protected]>
cixzhang
added a commit
that referenced
this pull request
Apr 26, 2026
….2 (#533) BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs. Removed: - XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps) - XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps) - useXDSIcon hook (use getIcon from globalIconRegistry) - IconRegistryContext (use registerIcons + getIcon) - IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx) - getGlobalRegistry internal helper (no longer needed) Added: - migrate-useXDSIcon-to-getIcon codemod with 11 tests - Updates internal imports from IconRegistry to globalIconRegistry Migration codemods exist for all removed APIs: - rename-topnav-title-to-heading (PR #530) - rename-sidenav-header-to-heading (PR #530) - migrate-useXDSIcon-to-getIcon (this PR) Refs: #527, #530, #531 Co-authored-by: navi[bot] <[email protected]>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
Replace all component-level useXDSIcon() calls with getIcon() from the global icon registry. This removes the React Context dependency for icon resolution, making icons work in both server and client environments. Changes: - XDSIcon: use getIcon() instead of useXDSIcon() - XDSCollapsible: use getIcon() instead of useXDSIcon() - XDSMoreMenu: use getIcon() instead of useXDSIcon() - XDSTheme: remove IconRegistryContext.Provider wrapper, keep registerIcons() - IconRegistry: deprecate useXDSIcon and IconRegistryContext with JSDoc - globalIconRegistry: update docs to reflect it's the single icon path - Icon/index.ts: mark deprecated exports with JSDoc Co-authored-by: navi[bot] <[email protected]>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
….2 (#533) BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs. Removed: - XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps) - XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps) - useXDSIcon hook (use getIcon from globalIconRegistry) - IconRegistryContext (use registerIcons + getIcon) - IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx) - getGlobalRegistry internal helper (no longer needed) Added: - migrate-useXDSIcon-to-getIcon codemod with 11 tests - Updates internal imports from IconRegistry to globalIconRegistry Migration codemods exist for all removed APIs: - rename-topnav-title-to-heading (PR #530) - rename-sidenav-header-to-heading (PR #530) - migrate-useXDSIcon-to-getIcon (this PR) Refs: #527, #530, #531 Co-authored-by: navi[bot] <[email protected]>
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
Replace all component-level useXDSIcon() calls with getIcon() from the global icon registry. This removes the React Context dependency for icon resolution, making icons work in both server and client environments. Changes: - XDSIcon: use getIcon() instead of useXDSIcon() - XDSCollapsible: use getIcon() instead of useXDSIcon() - XDSMoreMenu: use getIcon() instead of useXDSIcon() - XDSTheme: remove IconRegistryContext.Provider wrapper, keep registerIcons() - IconRegistry: deprecate useXDSIcon and IconRegistryContext with JSDoc - globalIconRegistry: update docs to reflect it's the single icon path - Icon/index.ts: mark deprecated exports with JSDoc
cixzhang
added a commit
that referenced
this pull request
Jun 21, 2026
….2 (#533) BREAKING CHANGE: Remove deprecated exports that were replaced in prior PRs. Removed: - XDSTopNavTitle, XDSTopNavTitleProps (use XDSTopNavHeading, XDSTopNavHeadingProps) - XDSSideNavHeader, XDSSideNavHeaderProps (use XDSSideNavHeading, XDSSideNavHeadingProps) - useXDSIcon hook (use getIcon from globalIconRegistry) - IconRegistryContext (use registerIcons + getIcon) - IconRegistry.tsx (deleted — all functionality lives in globalIconRegistry.tsx) - getGlobalRegistry internal helper (no longer needed) Added: - migrate-useXDSIcon-to-getIcon codemod with 11 tests - Updates internal imports from IconRegistry to globalIconRegistry Migration codemods exist for all removed APIs: - rename-topnav-title-to-heading (PR #530) - rename-sidenav-header-to-heading (PR #530) - migrate-useXDSIcon-to-getIcon (this PR) Refs: #527, #530, #531
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.
What
Migrates all internal component icon resolution from
useXDSIcon()(React Context hook) togetIcon()(module-level function from the global registry). This establishes a single path for icon resolution that works in both server and client environments.Follows up on #528 which added
registerIcons()andgetIcon().Why
useXDSIcon()requires React Context (IconRegistryContext) which only works client-side. With RSC adoption, components need icons without hooks.getIcon()reads from module-level state — no Context, no hooks, works everywhere.Changes
Components migrated (3 files)
XDSIcon.tsx—IconFromRegistrynow callsgetIcon(name)instead ofuseXDSIcon(name)XDSCollapsible.tsx— chevron icon viagetIcon('chevronDown')XDSMoreMenu.tsx— more icon viagetIcon('moreHorizontal')Theme updated (1 file)
XDSTheme.tsx— RemovedIconRegistryContext.Providerwrapper. Icons are now set globally viaregisterIcons(icons)only. No Context needed.Deprecated (1 file)
IconRegistry.tsx—useXDSIconandIconRegistryContextmarked@deprecatedwith JSDoc. Kept exported for backward compatibility.Exports updated (1 file)
Icon/index.ts— deprecated exports annotated with JSDoc commentDocs updated (1 file)
globalIconRegistry.tsx— updated comments to reflect it's now the single icon resolution pathVerification
yarn build— passesyarn test— 1390 tests passyarn lint— 0 errors (pre-existing warnings only)useXDSIcon(only the deprecated export itself)