Skip to content

fix(router): unsubscribe from route data when outlet deactivates - #71106

Open
atscott wants to merge 1 commit into
angular:mainfrom
atscott:fix/router-deactivate-unsubscribe
Open

atscott wants to merge 1 commit into
angular:mainfrom
atscott:fix/router-deactivate-unsubscribe

Conversation

@atscott

@atscott atscott commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

When RouterOutlet.deactivate() is called, the outlet destroys the active component but previously did not unsubscribe from route data. This left the route data subscription and resource binding effects (outletEffects) active in the input binder until either the next component was activated on that outlet or the outlet itself was destroyed via ngOnDestroy.

This commit updates deactivate() to call inputBinder?.unsubscribeFromRouteData(this), eagerly tearing down the route-data subscription and resource binding effects at destroy time.

When RouterOutlet.deactivate() is called, the outlet destroys the active
component but previously did not unsubscribe from route data. This left
the route data subscription and resource binding effects active in the
input binder until either the next component was activated on that outlet
or the outlet itself was destroyed in ngOnDestroy.

This commit eagerly unsubscribes from route data and tears down binding
effects in deactivate(), ensuring prompt cleanup when an outlet
component is destroyed.
@ngbot ngbot Bot added this to the Backlog milestone Sep 30, 2026
@atscott atscott added the target: patch This PR is targeted for the next patch release label Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: router target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants