Replace ChildComponent with DestroyRef + takeUntilDestroyed - #608
Merged
Conversation
Extract shared reactive state (debugmode, disableAds, favorites, hiddenMilestones) into AppStateService. ChildComponent now uses inject() with no constructor params and delegates to AppStateService. - Create AppStateService (providedIn: 'root') for shared state - Rewrite ChildComponent: inject() for DI, expose destroyRef - Update 76 subclass constructors: remove storageService param - Replace takeUntil(this.unsubscribe$) with takeUntilDestroyed in 40+ components - Remove unsubscribe$ from 7 root services (singletons never destroy) - Delete unused StreamingChildComponent (zero consumers) - Update app.component.ts with its own DestroyRef Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AppStateService—providedIn: 'root'singleton that subscribes toStorageService.settingFeedonce, exposingdebugmode,disableAds,favoritesList$,favoritesMap,hiddenMilestones,hiddenClanMilestonesChildComponentto useinject()field initializers (no constructor params), delegate shared state toAppStateService, and exposedestroyRefinstead ofunsubscribe$takeUntil(this.unsubscribe$)withtakeUntilDestroyed(this.destroyRef)across 40+ components, 7 root services (removed entirely — singletons never destroy), andapp.component.tsStreamingChildComponent(zero consumers — functionality moved toStreamingService)88 files changed, 343 insertions, 572 deletions. Templates unchanged — all property names remain identical on component instances.
Test plan
ng build— clean compilationnpm run test:ci— 185 tests passnpm run lint— 0 errors (465 pre-existingno-explicit-anywarnings)debugmode|async,loading|async,hiddenMilestones|asynctemplate bindings work correctly🤖 Generated with Claude Code