Skip to content

perf(multiple): Don't double-inject the style loader. #30467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/material/badge/badge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ export class MatBadge implements OnInit, OnDestroy {
constructor(...args: unknown[]);

constructor() {
inject(_CdkPrivateStyleLoader).load(_MatBadgeStyleLoader);
inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
const styleLoader = inject(_CdkPrivateStyleLoader);
styleLoader.load(_MatBadgeStyleLoader);
styleLoader.load(_VisuallyHiddenLoader);

if (typeof ngDevMode === 'undefined' || ngDevMode) {
const nativeElement = this._elementRef.nativeElement;
Expand Down
5 changes: 3 additions & 2 deletions src/material/chips/chip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,9 @@ export class MatChip implements OnInit, AfterViewInit, AfterContentInit, DoCheck
constructor(...args: unknown[]);

constructor() {
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
const styleLoader = inject(_CdkPrivateStyleLoader);
styleLoader.load(_StructuralStylesLoader);
styleLoader.load(_VisuallyHiddenLoader);
const animationMode = inject(ANIMATION_MODULE_TYPE, {optional: true});
this._animationsDisabled = animationMode === 'NoopAnimations';
this._monitorFocus();
Expand Down
5 changes: 3 additions & 2 deletions src/material/core/option/option.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ export class MatOption<T = any> implements FocusableOption, AfterViewChecked, On

constructor(...args: unknown[]);
constructor() {
inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
const styleLoader = inject(_CdkPrivateStyleLoader);
styleLoader.load(_StructuralStylesLoader);
styleLoader.load(_VisuallyHiddenLoader);
this._signalDisableRipple = !!this._parent && isSignal(this._parent.disableRipple);
}

Expand Down
5 changes: 3 additions & 2 deletions src/material/stepper/step-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ export class MatStepHeader extends CdkStepHeader implements AfterViewInit, OnDes
constructor() {
super();

inject(_CdkPrivateStyleLoader).load(_StructuralStylesLoader);
inject(_CdkPrivateStyleLoader).load(_VisuallyHiddenLoader);
const styleLoader = inject(_CdkPrivateStyleLoader);
styleLoader.load(_StructuralStylesLoader);
styleLoader.load(_VisuallyHiddenLoader);
const changeDetectorRef = inject(ChangeDetectorRef);
this._intlSubscription = this._intl.changes.subscribe(() => changeDetectorRef.markForCheck());
}
Expand Down
Loading