Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 1, 2026

Router navigation event subscription was removed in commit f4b446f, breaking automatic scroll-to-top behavior when navigating between CV sections.

Changes

  • Restored Router subscription: Re-added router.events subscription filtered by NavigationEnd to call window.scrollTo(0, 0) on route changes
  • Lifecycle management: Implemented OnDestroy to unsubscribe from both router and languageChanged subscriptions, preventing memory leaks
  • Fixed decorator placement: Moved GeneralData interface definition before @Component decorator to resolve TypeScript compilation errors
this.routerSubscription = this.router.events
  .pipe(filter(event => event instanceof NavigationEnd))
  .subscribe(() => {
    window.scrollTo(0, 0);
  });
ngOnDestroy() {
  this.routerSubscription?.unsubscribe();
  this.languageSubscription?.unsubscribe();
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

StegSchreck and others added 16 commits January 1, 2026 18:22
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan

* Remove commented-out border-right style from print.css

Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
* Initial plan

* Remove empty CSS rule blocks from print.css

Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
* Initial plan

* Add conditional guards for tag iterations in projectItems and talkItems sections

Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
Co-authored-by: Sebastian Schreck <StegSchreck@users.noreply.github.com>
* Initial plan

* Fix data loading issue - ensure title and meta are set after generalData is populated

Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI and others added 3 commits January 1, 2026 18:22
…onality

Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
Co-authored-by: StegSchreck <9078002+StegSchreck@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 1, 2026

Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • googlechromelabs.github.io
    • Triggering command: /usr/local/bin/node node install.mjs (dns block)
  • https://storage.googleapis.com/chrome-for-testing-public/143.0.7499.169/linux64/chrome-headless-shell-linux64.zip
    • Triggering command: /usr/local/bin/node node install.mjs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Address feedback from review on Print CSS implementation Restore scroll-to-top on route navigation with proper cleanup Jan 1, 2026
Copilot AI requested a review from StegSchreck January 1, 2026 18:27
@StegSchreck StegSchreck marked this pull request as ready for review January 1, 2026 18:34
Copilot AI review requested due to automatic review settings January 1, 2026 18:34
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores the scroll-to-top functionality when navigating between CV sections, which was previously removed in commit f4b446f. The implementation adds manual router event subscription with proper lifecycle management.

  • Restored router subscription to trigger window.scrollTo(0, 0) on NavigationEnd events
  • Implemented OnDestroy lifecycle hook with cleanup for both router and language service subscriptions
  • Fixed TypeScript interface placement by moving GeneralData interface before the @component decorator

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app/app.component.ts Adds router subscription for scroll-to-top behavior, implements OnDestroy for subscription cleanup, and fixes interface placement issue
.gitignore Excludes package-lock.json to prevent conflicts with Yarn-based dependency management

Comment on lines +52 to +55
ngOnDestroy() {
this.routerSubscription?.unsubscribe();
this.languageSubscription?.unsubscribe();
}
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ngOnDestroy lifecycle hook is unlikely to be called for the root AppComponent in a typical Angular application. The root component is only destroyed when the entire application shuts down (e.g., closing the browser tab), at which point all resources are automatically released by the browser. While implementing ngOnDestroy shows good practice for subscription cleanup, the unsubscribe calls here will effectively never execute in production.

For the root component, subscription cleanup is not critical since the subscriptions will live for the application's entire lifetime. However, if this pattern is intended to be educational or for consistency, it's acceptable to keep.

Copilot uses AI. Check for mistakes.
Comment on lines 39 to 44
// Scroll to top on route navigation
this.routerSubscription = this.router.events
.pipe(filter(event => event instanceof NavigationEnd))
.subscribe(() => {
window.scrollTo(0, 0);
});
Copy link

Copilot AI Jan 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using Angular Router's built-in scroll restoration feature instead of manually subscribing to router events. You can configure this in the RouterModule by adding the scrollPositionRestoration option:

In app-routing.module.ts, modify the RouterModule.forRoot() call:
RouterModule.forRoot(routes, {
preloadingStrategy: PreloadAllModules,
scrollPositionRestoration: 'top'
})

This approach is more declarative, doesn't require subscription management, and is the recommended Angular way to handle scroll-to-top behavior on navigation. It would eliminate the need for the router subscription in the constructor and the routerSubscription property.

Copilot uses AI. Check for mistakes.
Base automatically changed from feat/design-print-css_#40 to master January 1, 2026 19:01
@StegSchreck StegSchreck closed this Jan 1, 2026
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.

2 participants