mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
committed by
Kristiyan Kostadinov
parent
80eb5c4d8a
commit
3b73eff0b4
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -9,6 +9,5 @@
|
||||
import {InjectionToken, signal} from '@angular/core';
|
||||
|
||||
export const IS_SEARCH_DIALOG_OPEN = new InjectionToken('', {
|
||||
providedIn: 'root',
|
||||
factory: () => signal(false),
|
||||
});
|
||||
|
||||
@@ -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)),
|
||||
});
|
||||
|
||||
|
||||
@@ -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}];
|
||||
});
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user