Repository navigation
perf(grid): fix style recalculation regressions in grid themes and component styles - #17839
Merged
Merged
Conversation
Chromium (and WebKit) only bucket a rule by a :where()/:is() subject when it holds a single selector; multi-argument lists land in the universal bucket and are matched against every element on each style recalculation. Wrap each selector of the scope() list in its own :where(), and split the header item rule the same way. Specificity and matching are unchanged. Closes #17793
Angular removes a ViewEncapsulation.None component's styles with its last instance and re-inserts them with the next, restyling the page. Add IgxStylesRegistrar.retain() to keep them via one detached instance per app, and retain the components the grid creates and destroys while filtering, grouping, editing and loading. Refs #17794
Merged
9 of 23 tasks
Member
|
@simeonoff , please solve the merge conflict |
…ce-fixes # Conflicts: # CHANGELOG.md # projects/igniteui-angular/core/src/core/styles/themes/_scoping.scss
Member
Author
Done. |
The detached input group kept alive by IgxStylesRegistrar.retain() has no projected igxInput, so a runtime THEME_TOKEN change ran detectChanges() on it and threw from isFileType. Make the getters null-safe.
Member
|
@simeonoff , can you fix the conflict? |
…ce-fixes # Conflicts: # projects/igniteui-angular/input-group/src/input-group/input-group.component.spec.ts
ChronosSF
approved these changes
Oct 30, 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.
Closes #17793
Addresses (a) of #17794. Part (b) is out of scope (see the issue thread), and (c) plus the Excel-style filter menu are follow-ups.
Description
scope()mixin wraps each selector of its list in its own:where(), and the grid header item rule is split the same way. Chromium and WebKit can't file a rule under a key when its subject is a multi-argument:where(), so they matched these rules against every element on each style recalculation. Specificity and matching are unchanged.IgxStylesRegistrar.retain(...components)keeps one detached instance of each component per application, so Angular never removes its stylesheet. This follows the pattern of Angular CDK's_CdkPrivateStyleLoader.IgxGridBaseDirectiveretains the six components that filtering, grouping, editing andisLoadingcreate and destroy: badge, chip, checkbox, input group, date picker and circular progress bar.Motivation / Context
Both are performance regressions in the grid since 22.0 and 22.1. Measured at 4× CPU throttling, as main-thread time:
isLoadingon / offThe JS bundle grows by 12 bytes; no CSS is duplicated.
Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Grid (all variants), Theming,
IgxStylesRegistrarHow Has This Been Tested?
Unit tests
Manual testing
Automated e2e tests
Unit tests:
styles-registrar.service.spec.tscoversregister()andretain(). Removing any piece of the logic makes at least one test fail. The themescope()mixin has a style test. The grid selection, editing, filtering, group-by, tree grid and hierarchical grid suites pass.CSS equivalence (Performance regression: multi-argument :where() theme selectors slow grid style recalculation since 22.0.0 #17793): across all 13 presets and every component sheet, the compiled CSS normalizes to identical output (multi-argument
:where()distributed, selectors sorted per rule).Visual parity (Performance regression: bundled component styles make grid filtering up to 2× slower since 22.1.0 #17794): computed styles of every element match the baseline across filtering, grouping, editing, loading, the Excel-style menu, and the tree, hierarchical and pivot grids, in all four themes.
Style churn: traced with a
MutationObserveron<head>. No retained sheet is added or removed after load.Test Configuration:
Screenshots / Recordings
N/A, no visual changes.
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)