refactor(icon): Enhanced multi-theme support and improved performance#2087
Open
rkaraivanov wants to merge 1 commit intomasterfrom
Open
refactor(icon): Enhanced multi-theme support and improved performance#2087rkaraivanov wants to merge 1 commit intomasterfrom
rkaraivanov wants to merge 1 commit intomasterfrom
Conversation
Features: - Add support for multiple themes coexisting on the same page - Icon references now resolve based on per-component theme context - Icons within different igc-theme-provider elements render correctly - Implement batched notifications using microtask queue for performance - Add automatic deduplication of icon change notifications Performance Improvements: - Refactor _iconLoaded to class method instead of arrow function property * Reduces memory footprint by sharing method across all icon instances * Still maintains proper lifecycle management with bound references - Implement notification batching to prevent excessive listener calls * Uses queueMicrotask for zero-delay batching * Automatically deduplicates icon:collection pairs * Significantly improves performance when registering multiple icons Architecture Changes: - Remove global theme state from IconsRegistry singleton - Pass theme as parameter to getIconRef() for stateless resolution - Icon components now pass their local theme context to registry - Each icon resolves references based on its own theme-provider context - Preserve backward compatibility with optional theme parameter Icon Resolution Priority (updated): 1. User-set references (external or internal) 2. Theme-specific aliases from ICON_REFERENCES 3. Default theme fallback 4. Return icon as-is if no reference found Added API docuementation for all new and updated methods, properties, and behaviors. Added comprehensive unit and integration tests covering multi-theme scenarios, BFCache handling, and theme-provider interactions. Fixes: - Icons now work correctly in multi-theme applications - No more theme conflicts when using multiple theme-providers - Prevents unnecessary re-renders during bulk icon registration - Eliminates potential race conditions in theme state This refactor enables proper multi-theme support while maintaining backward compatibility and improving overall performance through batched notifications.
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
Features:
Performance Improvements:
Architecture Changes:
Icon Resolution Priority (updated):
Added API docuementation for all new and updated methods, properties, and behaviors. Added comprehensive unit and integration tests covering multi-theme scenarios, BFCache handling, and theme-provider interactions.
Fixes:
This refactor enables proper multi-theme support while maintaining backward compatibility and improving overall performance through batched notifications.
Type of Change
Checklist