From 45c94ab0f6eb6e7b66c107474038fed1a82cd100 Mon Sep 17 00:00:00 2001 From: dcaslin Date: Sat, 11 Apr 2026 12:18:14 -0400 Subject: [PATCH] Convert clan-state.service BehaviorSubjects to Angular signals Converted 17 BehaviorSubjects in ClanStateService to signals and updated 16 consumer components/templates. Replaced .next() with .set(), .getValue() with direct signal calls, removed async pipe from templates, and converted component subscriptions to effect(). Also converted local BehaviorSubjects in 4 child components to signals. Co-Authored-By: Claude Opus 4.6 --- docs/modernization-plan.md | 21 +-- package.json | 2 +- .../clan-badges/clan-badges.component.html | 2 +- .../clan-badges/clan-badges.component.ts | 4 +- .../clan-collection-search.component.html | 2 +- .../clan-collection-search.component.ts | 36 ++--- .../clan-collections.component.html | 2 +- .../clan-collections.component.ts | 4 +- .../clan/clan-info/clan-info.component.html | 10 +- src/app/clan/clan-info/clan-info.component.ts | 25 ++-- .../clan-lifetime.component.html | 10 +- .../clan-lifetime/clan-lifetime.component.ts | 28 ++-- .../clan-members/clan-members.component.html | 8 +- .../clan-milestones.component.html | 4 +- .../clan-milestones.component.ts | 21 ++- .../clan-settings.component.html | 2 +- .../clan-settings/clan-settings.component.ts | 4 +- src/app/clan/clan-state.service.ts | 127 +++++++++--------- .../clan-seals/clan-seals.component.html | 2 +- .../clan-seals/clan-seals.component.ts | 4 +- .../clan-triumph-search.component.html | 2 +- .../clan-triumph-search.component.ts | 28 ++-- .../clan-triumph-tracked.component.html | 2 +- .../clan-triumph-tracked.component.ts | 4 +- .../clan-triumphs.component.html | 2 +- .../clan-triumphs/clan-triumphs.component.ts | 4 +- src/app/clan/clan.component.html | 10 +- src/app/clan/clan.component.ts | 4 +- 28 files changed, 182 insertions(+), 192 deletions(-) diff --git a/docs/modernization-plan.md b/docs/modernization-plan.md index 1e71b6448..c14484630 100644 --- a/docs/modernization-plan.md +++ b/docs/modernization-plan.md @@ -108,14 +108,19 @@ Remaining: ## Phase 6: Further Signal Adoption -274 `BehaviorSubject` instances across 52 files. Some already converted to signals. - -Priority conversions: -- [ ] `gear-filter-state.service.ts` (45 BehaviorSubjects) -- [ ] `uber-list-state.service.ts` (28 BehaviorSubjects) -- [ ] `clan-state.service.ts` (18 BehaviorSubjects) -- [ ] Evaluate Angular 19 signal APIs (`resource()`, `linkedSignal()`) after Phase 2 -- [ ] Convert incrementally, one service per PR +Started at 177 `BehaviorSubject` instances across 52 files. + +Completed (PR #1): +- [x] `clan-state.service.ts` — converted 17 BehaviorSubjects to signals, updated 16 consumer components/templates + - Service: `.next()` → `.set()`, `.getValue()` → `()` + - Templates: removed `| async` pipe, use direct signal call `()` + - Components: replaced `.subscribe()` with `effect()`, converted local BehaviorSubjects to signals + +Remaining: +- [ ] `gear-filter-state.service.ts` (23 BehaviorSubjects) +- [ ] `uber-list-state.service.ts` (17 BehaviorSubjects) +- [ ] Evaluate Angular 19 signal APIs (`resource()`, `linkedSignal()`) +- [ ] Convert remaining services incrementally, one per PR **Done when:** BehaviorSubject count under 150. The three largest files are converted. diff --git a/package.json b/package.json index c8511d163..e3c573c31 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "d2-checklist", - "version": "30.1.0", + "version": "30.2.0", "manifest": "242999.26.03.25.2000-1-bnet.64463", "license": "MIT", "scripts": { diff --git a/src/app/clan/clan-collections/clan-badges/clan-badges.component.html b/src/app/clan/clan-collections/clan-badges/clan-badges.component.html index f8f96cba7..8458ff2f1 100644 --- a/src/app/clan/clan-collections/clan-badges/clan-badges.component.html +++ b/src/app/clan/clan-collections/clan-badges/clan-badges.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/app/clan/clan-collections/clan-badges/clan-badges.component.ts b/src/app/clan/clan-collections/clan-badges/clan-badges.component.ts index d52dc8c7d..1715091ad 100644 --- a/src/app/clan/clan-collections/clan-badges/clan-badges.component.ts +++ b/src/app/clan/clan-collections/clan-badges/clan-badges.component.ts @@ -3,7 +3,7 @@ import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { ClanBadge, ClanStateService } from '@app/clan/clan-state.service'; import { ChildComponent } from '@app/shared/child.component'; import { ClanCollectionBadgeDialogComponent } from '../clan-collection-badge-dialog/clan-collection-badge-dialog.component'; -import { NgIf, NgFor, AsyncPipe } from '@angular/common'; +import { NgIf, NgFor } from '@angular/common'; import { MatButton } from '@angular/material/button'; @Component({ @@ -11,7 +11,7 @@ import { MatButton } from '@angular/material/button'; selector: 'd2c-clan-badges', templateUrl: './clan-badges.component.html', styleUrls: ['./clan-badges.component.scss'], - imports: [NgIf, NgFor, MatButton, AsyncPipe] + imports: [NgIf, NgFor, MatButton] }) export class ClanBadgesComponent extends ChildComponent { diff --git a/src/app/clan/clan-collections/clan-collection-search/clan-collection-search.component.html b/src/app/clan/clan-collections/clan-collection-search/clan-collection-search.component.html index 0a4dcd381..cf59beac8 100644 --- a/src/app/clan/clan-collections/clan-collection-search/clan-collection-search.component.html +++ b/src/app/clan/clan-collections/clan-collection-search/clan-collection-search.component.html @@ -1,4 +1,4 @@ -