refactor: Remove duplicate layout components and fix memory leaks#95
Merged
Conversation
…ts and fix accessibility Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
Co-authored-by: PhantomDave <34485699+PhantomDave@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor routing and layout components for improved navigation
refactor: Remove duplicate layout components and fix memory leaks
Nov 24, 2025
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses technical debt and improves code quality by removing redundant layout components, fixing memory leaks, and enhancing keyboard accessibility. The changes align with Angular best practices for the zoneless, signal-based architecture used in this application.
Key Changes:
- Eliminated three duplicate layout wrapper components (
HomeLayoutComponent,MovementsLayoutComponent,AnalyticsLayoutComponent) that only contained<router-outlet />, simplifying the routing structure - Fixed memory leaks in
BreadcrumbComponentandSideNavComponentby applyingtakeUntilDestroyed()to router event subscriptions - Added keyboard navigation support (Enter and Space keys) to theme toggle and logout buttons
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/src/app/layouts/home-layout/home-layout.component.ts | Removed redundant wrapper component containing only <router-outlet /> |
| frontend/src/app/layouts/movements-layout/movements-layout.component.ts | Removed redundant wrapper component containing only <router-outlet /> |
| frontend/src/app/layouts/analytics-layout/analytics-layout.component.ts | Removed redundant wrapper component containing only <router-outlet /> |
| frontend/src/app/app.routes.ts | Removed references to deleted layout components from route configurations |
| frontend/src/app/components/ui-library/breadcrumb/breadcrumb.component.ts | Added takeUntilDestroyed() to router subscription for automatic cleanup; moved subscription to constructor |
| frontend/src/app/components/side-nav-component/side-nav-component.ts | Added takeUntilDestroyed() to router subscription; removed unnecessary OnInit implementation; moved subscription to constructor |
| frontend/src/app/components/side-nav-component/side-nav-component.html | Added keydown.enter and keydown.space handlers with preventDefault() to theme toggle and logout buttons for keyboard accessibility |
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.
Addresses code review feedback from PR #94: duplicate layout components violating DRY, memory leaks from unsubscribed observables, and missing keyboard accessibility handlers.
Changes
Removed duplicate layout components:
HomeLayoutComponent,MovementsLayoutComponent, andAnalyticsLayoutComponentwere identical wrappers containing only<router-outlet />. Routes now reference child components directly.Fixed memory leaks: Router event subscriptions in
BreadcrumbComponentandSideNavComponentnow usetakeUntilDestroyed()from@angular/core/rxjs-interopfor automatic cleanup.Added keyboard accessibility: Theme toggle and logout buttons now handle
keydown.enterandkeydown.spaceevents withpreventDefault()to support keyboard navigation without double-triggering.Before (routes.ts):
After:
Before (subscriptions):
After:
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.