docs(docs-infra): apply OnPush change detection and remove redundant root provider

Adds OnPush change detection and removes a redundant `providedIn: 'root'` injection token.
This commit is contained in:
SkyZeroZx 2025-12-19 19:24:56 -05:00 committed by Kristiyan Kostadinov
parent 80eb5c4d8a
commit 3b73eff0b4
7 changed files with 6 additions and 6 deletions

View file

@ -14,7 +14,6 @@ import {IconComponent} from '../icon/icon.component';
import {IsActiveNavigationItem} from '../../pipes';
import {NgTemplateOutlet, TitleCasePipe} from '@angular/common';
import {MatTooltipModule} from '@angular/material/tooltip';
import {ReactiveFormsModule} from '@angular/forms';
@Component({
selector: 'docs-navigation-list',
@ -25,7 +24,6 @@ import {ReactiveFormsModule} from '@angular/forms';
IsActiveNavigationItem,
NgTemplateOutlet,
MatTooltipModule,
ReactiveFormsModule,
TitleCasePipe,
],
templateUrl: './navigation-list.component.html',

View file

@ -16,6 +16,7 @@ import {
afterRenderEffect,
Renderer2,
ElementRef,
ChangeDetectionStrategy,
} from '@angular/core';
import {_IdGenerator} from '@angular/cdk/a11y';
@ -31,6 +32,7 @@ import {_IdGenerator} from '@angular/cdk/a11y';
host: {
class: 'docs-tab-group',
},
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class TabGroup {
private readonly _renderer = inject(Renderer2);

View file

@ -83,6 +83,7 @@ async function getFileAndContent(workingDir: string, path: string): Promise<File
return {content, path};
}
// Use once we restore the StackBlitz feature
async function createPostData(
exampleDir: string,
config: ZipConfig,

View file

@ -9,6 +9,5 @@
import {InjectionToken, signal} from '@angular/core';
export const IS_SEARCH_DIALOG_OPEN = new InjectionToken('', {
providedIn: 'root',
factory: () => signal(false),
});

View file

@ -10,7 +10,6 @@ import {isPlatformBrowser} from '@angular/common';
import {InjectionToken, PLATFORM_ID, inject} from '@angular/core';
export const LOCAL_STORAGE = new InjectionToken<Storage | null>('LOCAL_STORAGE', {
providedIn: 'root',
factory: () => getStorage(inject(PLATFORM_ID)),
});

View file

@ -101,7 +101,7 @@ export class NavigationState {
private expand(item: NavigationItem): void {
// Add item to the expanded items list
this._expandedItems.update((expandedItems) => {
this._expandedItems.update(() => {
return [...(this.actualExpandedItems() ?? []), {...item, isExpanded: true}];
});

View file

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, inject, signal} from '@angular/core';
import {ChangeDetectionStrategy, Component, inject, signal} from '@angular/core';
import {ActivatedRoute, RouterLink, UrlSegment} from '@angular/router';
import {Search, SearchItem, RelativeLink, SearchResultItem} from '@angular/docs';
@ -14,6 +14,7 @@ import {Search, SearchItem, RelativeLink, SearchResultItem} from '@angular/docs'
imports: [SearchItem, RouterLink, RelativeLink],
templateUrl: './not-found.html',
styleUrl: './not-found.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NotFound {
private readonly search = inject(Search);