Northeastern-Electric-Racing / Northeastern-Electric-Racing/Argos
Migrate subscription cleanup to takeUntilDestroyed
@bracyw is already working on this.
Since Mar 29, 2026.
- Dominant language
- TypeScript
- Stars
- 5
- Forks
- 1
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 26
Description
Description
Components across the codebase manage observable subscriptions manually with Subscription[] arrays and ngOnDestroy cleanup. Angular 16+ provides takeUntilDestroyed() from @angular/core/rxjs-interop which automatically unsubscribes when a component is destroyed — no OnDestroy boilerplate needed. This ticket migrates all components to that pattern, which also fixes ~18 components that currently have no cleanup at all.
Acceptance Criteria
- All components using manual Subscription[] + ngOnDestroy cleanup are migrated to takeUntilDestroyed()
- All components that currently lack cleanup (~18) are fixed by adding takeUntilDestroyed() to their subscribe pipes
- Remove OnDestroy implementations that only exist for subscription cleanup
- No behavioral changes — only lifecycle cleanup approach changes
- Run
ng buildto verify no regressions
Proposed Solution
Import DestroyRef and takeUntilDestroyed from @angular/core/rxjs-interop. Inject DestroyRef, then pipe each observable through takeUntilDestroyed() before subscribing. Remove the Subscription[] array, the push calls, and the ngOnDestroy forEach unsubscribe block. Start with the ~18 components missing cleanup entirely, then migrate the ~25 components that already have manual cleanup. Test with ng build.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.