Skip to content

Angular 04: signals - #35

Merged
gpbsumido merged 6 commits into
ps/ng-03-templatesfrom
ps/ng-04-signals
Nov 21, 2026
Merged

gpbsumido merged 6 commits into
ps/ng-03-templatesfrom
ps/ng-04-signals

Conversation

@gpbsumido

@gpbsumido gpbsumido commented Nov 21, 2026 •

Copy link
Copy Markdown
Owner

Fourth lesson in my Angular guide. The feature slice is series navigation in the reader, and adding it exposed a stale-route bug that the signals refactor fixes.

What shipped

Series navigation. Every Angular guide lesson ends with "Part N of M" plus previous/next routerLinks, which prerender as real hrefs.

Fix: the reader went stale on reuse

  • thought-detail.ts read route.snapshot once, and the router reuses the component when only :slug changes.
  • The slug is now toSignal(route.paramMap). The thought, series position and lazy lesson page are computed()/resource({ params }) off it.
  • Effects handle the SEO meta and the scroll-to-top.

Reader specs on RouterTestingHarness. They now navigate for real. A mocked snapshot can't express a reused component receiving a new param, which is how the bug hid.

Dock state is read-only. DockService keeps private writable signals and exposes asReadonly() views. The two hand-rolled "minimize" Map writes in app.ts and menu-bar.service.ts now call minimizeApp().

Lesson 04: signals (/thoughts/angular-04-signals)

  • Covers the material at three levels (simple, intermediate, expert), then pitfalls and interview Q&A.
  • Demos: effect batching (three writes, one run) and a resettable linkedSignal selection.

Version and changelog. 1.4.3, with a matching changelog entry.

Bundle

Initial bundle went from 377.25 kB to 384.14 kB. A measurement build without RouterLink comes out at 377.83 kB, so the link directive is the 6.3 kB. I'm keeping it: real links and correct ⌘-click behaviour beat a hand-rolled click handler, and later lessons reuse it. That leaves 16 kB of headroom under the 400 kB budget.

Commits

  1. Add failing specs for series nav, reactive slugs, dock state and lesson 04
  2. Add a failing spec for scrolling to the top between lessons
  3. Make dock state read-only and give minimize one home
  4. Drive the reader from a slug signal and add series navigation
  5. Write lesson 04 with effect-batching and linkedSignal demos
  6. Bump to 1.4.3 with the lesson 04 changelog entry

Verification

  • RED before the fix: navigating 01 → 02 left the same instance titled "Angular 01: Project structure", and scrollTop stayed at 500.
  • ng test: 48 files, 356 tests, exit 0. Lint and both tsc --noEmit configs are clean.
  • Production build: no budget warnings. Prerendered lesson 02 contains "Part 2 of 4" and href="/thoughts/angular-03-templates".

TO-DOs for this PR

  • Before/after screenshots of a lesson's footer (series nav) and the lesson 04 page, light and dark. Chromium couldn't launch in the environment I built this in.

@gpbsumido
gpbsumido marked this pull request as ready for review November 21, 2026 14:58
@gpbsumido
gpbsumido added this pull request to stack #46 November 21, 2026 17:00
@gpbsumido
gpbsumido merged commit 530c68f into develop Nov 21, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant