perf(app): add OnPush to root App component

RC PERF-01 platform-wide performance audit. App was the only one of 191
@Component decorators still on default change detection; all state
mutation flows through signal.set()/router-event handlers, so OnPush is
safe (no direct DOM mutation, no non-signal mutable bindings read in the
template).

Audit findings (see report):
- RxJS subscription leaks: 149 .subscribe() calls across 44 files
  reviewed; all either use takeUntilDestroyed, manual Subscription +
  ngOnDestroy, or self-completing HTTP/shareReplay observables in
  providedIn:'root' singletons. No leaks found, no changes needed.
- OnPush coverage: 190/191 components already OnPush; app.ts fixed here.
- @for/*ngFor tracking: 0 legacy *ngFor found; @for requires track at
  compile time in this Angular version. Already fully compliant.
- Duplicate HTTP calls: CategoryFacade and ConfigService already use
  shareReplay({bufferSize:1, refCount:true}) caching consistently.
- Signals/BehaviorSubject boilerplate: only 2 combineLatest usages
  app-wide, both narrow and already minimal; left as-is (no safe,
  isolated leaf case to convert without touching facade state shape).
- Template method calls: mostly cheap signal reads or small pure
  per-item formatters; none warranted extraction given OnPush is
  already in place everywhere they're used.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-07-24 08:08:51 +04:00
parent 28459a8274
commit 61a57142b0

View File

@@ -1,5 +1,5 @@
import { Component, OnInit, signal, ApplicationRef, inject, DestroyRef } from '@angular/core';
import { Component, OnInit, signal, ApplicationRef, inject, DestroyRef, ChangeDetectionStrategy } from '@angular/core';
import { Router, RouterOutlet, NavigationEnd } from '@angular/router';
import { Title } from '@angular/platform-browser';
import { HeaderComponent } from './components/header/header.component';
@@ -23,7 +23,8 @@ import { TelegramLoginComponent } from './components/telegram-login/telegram-log
selector: 'app-root',
imports: [RouterOutlet, HeaderComponent, FooterComponent, BackButtonComponent, TranslatePipe, FloatingNotificationsComponent, TelegramLoginComponent],
templateUrl: './app.html',
styleUrl: './app.scss'
styleUrl: './app.scss',
changeDetection: ChangeDetectionStrategy.OnPush
})
export class App implements OnInit {
protected title = '';