diff --git a/CHANGELOG.md b/CHANGELOG.md index 212c329..f15b235 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## 2026-11-21 - version 1.4.8 + +- **Every component is OnPush.** None of the 35 components set a change detection strategy, so every one was checked on every pass. Each now uses `ChangeDetectionStrategy.OnPush`. Before switching, I audited each component for state that changes outside signals and template events, the kind OnPush stops rendering, and found none. The contact form's reset after sending is the closest call, and it now carries a comment saying why it still renders +- **A test keeps it that way.** `architecture.spec.ts` reads every `@Component` decorator with the TypeScript parser and fails, naming the class, on any component that doesn't choose OnPush or an explicit `Eager`. Using the parser rather than a text search means the code samples printed in the lessons don't count as components +- **Angular guide, lesson 09: change detection** (`/thoughts/angular-09-change-detection`). The live demo passes one object to an `Eager` child and an `OnPush` child: mutating it updates only the Eager one, replacing it updates both, and a signal reaches the OnPush child with no input change at all. The lesson covers zoneless scheduling, `markForCheck` vs `detectChanges`, NG0100, and the 21.2 rename of `Default` to `Eager` + ## 2026-11-21 - version 1.4.7 - **fix: the contact form accepted blank messages.** `Validators.required` only rejects an empty string, so a name or message of nothing but spaces got through. Both now use a small `notBlank` validator in `shared/validators.ts` diff --git a/package-lock.json b/package-lock.json index 97c9914..93ce887 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "angular-paul", - "version": "1.4.7", + "version": "1.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "angular-paul", - "version": "1.4.7", + "version": "1.4.8", "dependencies": { "@angular/common": "^21.2.0", "@angular/compiler": "^21.2.0", diff --git a/package.json b/package.json index ba9469d..b1d14a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "angular-paul", - "version": "1.4.7", + "version": "1.4.8", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/src/app/app.ts b/src/app/app.ts index aa9a9ed..16092c2 100644 --- a/src/app/app.ts +++ b/src/app/app.ts @@ -1,5 +1,5 @@ import { NgComponentOutlet } from '@angular/common'; -import { Component, effect, inject, viewChild } from '@angular/core'; +import { ChangeDetectionStrategy, Component, effect, inject, viewChild } from '@angular/core'; import { toSignal } from '@angular/core/rxjs-interop'; import { NavigationEnd, Router, RouterOutlet } from '@angular/router'; import { filter, map } from 'rxjs'; @@ -19,6 +19,7 @@ import { WindowManagerService } from './window-manager/window-manager.service'; @Component({ selector: 'app-root', + changeDetection: ChangeDetectionStrategy.OnPush, imports: [ RouterOutlet, Desktop, diff --git a/src/app/apps/about-app.ts b/src/app/apps/about-app.ts index cf52d40..b62d7f8 100644 --- a/src/app/apps/about-app.ts +++ b/src/app/apps/about-app.ts @@ -1,9 +1,10 @@ -import { Component, output, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, output, signal } from '@angular/core'; export type AboutTab = 'overview' | 'skills' | 'experience'; @Component({ selector: 'app-about', + changeDetection: ChangeDetectionStrategy.OnPush, template: `
👤
diff --git a/src/app/apps/contact-app.ts b/src/app/apps/contact-app.ts index 2a4142b..e906010 100644 --- a/src/app/apps/contact-app.ts +++ b/src/app/apps/contact-app.ts @@ -1,4 +1,4 @@ -import { Component, ElementRef, inject, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, ElementRef, inject, signal } from '@angular/core'; import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { notBlank } from '../shared/validators'; @@ -6,6 +6,7 @@ type SubmissionStatus = 'idle' | 'pending' | 'success' | 'error'; @Component({ selector: 'app-contact', + changeDetection: ChangeDetectionStrategy.OnPush, imports: [ReactiveFormsModule], template: `
@@ -249,6 +250,9 @@ export class ContactApp { this.submissionStatus.set('pending'); // Simulate async submission + // [ng-09 change detection] form.reset() changes plain control state, + // which marks nothing for check. It renders because the signal write next + // to it does. Drop that write and the old errors stay on screen. setTimeout(() => { this.submissionStatus.set('success'); this.form.reset(); diff --git a/src/app/apps/finder/finder-app.ts b/src/app/apps/finder/finder-app.ts index 03aac41..69081a0 100644 --- a/src/app/apps/finder/finder-app.ts +++ b/src/app/apps/finder/finder-app.ts @@ -1,8 +1,16 @@ -import { Component, computed, inject, output, signal } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + inject, + output, + signal, +} from '@angular/core'; import { FileSystemService, FileEntry } from './file-system.service'; @Component({ selector: 'app-finder', + changeDetection: ChangeDetectionStrategy.OnPush, template: `
diff --git a/src/app/apps/placeholder-app.ts b/src/app/apps/placeholder-app.ts index 4645b27..2443f39 100644 --- a/src/app/apps/placeholder-app.ts +++ b/src/app/apps/placeholder-app.ts @@ -1,7 +1,8 @@ -import { Component, input } from '@angular/core'; +import { ChangeDetectionStrategy, Component, input } from '@angular/core'; @Component({ selector: 'app-placeholder', + changeDetection: ChangeDetectionStrategy.OnPush, template: `
{{ icon() }} diff --git a/src/app/apps/projects-app.ts b/src/app/apps/projects-app.ts index 6f9a4ba..0f93875 100644 --- a/src/app/apps/projects-app.ts +++ b/src/app/apps/projects-app.ts @@ -1,4 +1,11 @@ -import { Component, computed, inject, output, signal } from '@angular/core'; +import { + ChangeDetectionStrategy, + Component, + computed, + inject, + output, + signal, +} from '@angular/core'; import { ProjectsService } from './projects.service'; export interface GitHubRepo { @@ -12,6 +19,7 @@ export interface GitHubRepo { @Component({ selector: 'app-projects', + changeDetection: ChangeDetectionStrategy.OnPush, template: `
diff --git a/src/app/apps/readme-app.ts b/src/app/apps/readme-app.ts index 77a96b0..9337a1e 100644 --- a/src/app/apps/readme-app.ts +++ b/src/app/apps/readme-app.ts @@ -1,8 +1,9 @@ -import { Component, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { AppLauncherService } from '../shared/app-launcher.service'; @Component({ selector: 'app-readme', + changeDetection: ChangeDetectionStrategy.OnPush, template: `

README.md

diff --git a/src/app/apps/settings/system-preferences.ts b/src/app/apps/settings/system-preferences.ts index 5253700..850e10f 100644 --- a/src/app/apps/settings/system-preferences.ts +++ b/src/app/apps/settings/system-preferences.ts @@ -1,4 +1,4 @@ -import { Component, inject, signal } from '@angular/core'; +import { ChangeDetectionStrategy, Component, inject, signal } from '@angular/core'; import { SettingsService } from '../../shared/settings/settings.service'; type Pane = 'appearance' | 'dock' | 'general'; @@ -10,6 +10,7 @@ interface SidebarItem { @Component({ selector: 'app-system-preferences', + changeDetection: ChangeDetectionStrategy.OnPush, template: `