From 3b73eff0b4a0e2bc56a8d976751d559aadc4c165 Mon Sep 17 00:00:00 2001 From: SkyZeroZx <73321943+SkyZeroZx@users.noreply.github.com> Date: Fri, 19 Dec 2025 19:24:56 -0500 Subject: [PATCH] docs(docs-infra): apply OnPush change detection and remove redundant root provider Adds OnPush change detection and removes a redundant `providedIn: 'root'` injection token. --- .../components/navigation-list/navigation-list.component.ts | 2 -- adev/shared-docs/components/tab-group/tab-group.component.ts | 2 ++ adev/shared-docs/pipeline/examples/zip/builder.mts | 1 + adev/shared-docs/providers/is-search-dialog-open.ts | 1 - adev/shared-docs/providers/local-storage.ts | 1 - adev/shared-docs/services/navigation-state.service.ts | 2 +- adev/src/app/features/not-found/not-found.ts | 3 ++- 7 files changed, 6 insertions(+), 6 deletions(-) diff --git a/adev/shared-docs/components/navigation-list/navigation-list.component.ts b/adev/shared-docs/components/navigation-list/navigation-list.component.ts index 59114cd3eae..4cc6d0040d7 100644 --- a/adev/shared-docs/components/navigation-list/navigation-list.component.ts +++ b/adev/shared-docs/components/navigation-list/navigation-list.component.ts @@ -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', diff --git a/adev/shared-docs/components/tab-group/tab-group.component.ts b/adev/shared-docs/components/tab-group/tab-group.component.ts index 2a09275226d..6f97bd315e5 100644 --- a/adev/shared-docs/components/tab-group/tab-group.component.ts +++ b/adev/shared-docs/components/tab-group/tab-group.component.ts @@ -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); diff --git a/adev/shared-docs/pipeline/examples/zip/builder.mts b/adev/shared-docs/pipeline/examples/zip/builder.mts index 55d535d42fa..bdb439592e9 100644 --- a/adev/shared-docs/pipeline/examples/zip/builder.mts +++ b/adev/shared-docs/pipeline/examples/zip/builder.mts @@ -83,6 +83,7 @@ async function getFileAndContent(workingDir: string, path: string): Promise signal(false), }); diff --git a/adev/shared-docs/providers/local-storage.ts b/adev/shared-docs/providers/local-storage.ts index c5ac69e5cd3..9769905505f 100644 --- a/adev/shared-docs/providers/local-storage.ts +++ b/adev/shared-docs/providers/local-storage.ts @@ -10,7 +10,6 @@ import {isPlatformBrowser} from '@angular/common'; import {InjectionToken, PLATFORM_ID, inject} from '@angular/core'; export const LOCAL_STORAGE = new InjectionToken('LOCAL_STORAGE', { - providedIn: 'root', factory: () => getStorage(inject(PLATFORM_ID)), }); diff --git a/adev/shared-docs/services/navigation-state.service.ts b/adev/shared-docs/services/navigation-state.service.ts index 2c469decd2f..c021190f3ac 100644 --- a/adev/shared-docs/services/navigation-state.service.ts +++ b/adev/shared-docs/services/navigation-state.service.ts @@ -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}]; }); diff --git a/adev/src/app/features/not-found/not-found.ts b/adev/src/app/features/not-found/not-found.ts index a1563e8df96..335ca1633a9 100644 --- a/adev/src/app/features/not-found/not-found.ts +++ b/adev/src/app/features/not-found/not-found.ts @@ -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);