-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Closed as not planned
Closed as not planned
Copy link
Labels
Milestone
Description
Which @angular/* package(s) are the source of the bug?
router
Is this a regression?
No
Description
When opening a URL in the browser, we can use Chrome DevTools Memory tab to snapshot Detached elements. When navigating to subsequent page using navigation above, the initial component remains in memory and is never freed.
Example app: https://stackblitz.com/edit/stackblitz-starters-nt5jurhb?file=src%2Fmain.ts
Repro steps:
- Start on the
/example1URL. See "Example 1" page. (good) - Open Chrome DevTools > Memory > Detached elements
- [Take snapshot] and see there are no detached nodes (good)
- Navigate to "Example 2" via the top navigation. See "Example 2" page. (good)
- [Take snapshot]
Expected:
There should be no "Detached elements" listed
Actual:
The app-example1 node is showing as detached.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-nt5jurhb?file=src%2Fmain.ts
Please provide the exception or error you saw
Also I have no idea how to debug this or things like this when they come up. Who has the handle and how can I clear it? I've already tried manually running GC so that doesn't seem to be the issue.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI : 21.0.2
Angular : 21.0.3
Node.js : 20.19.1
Package Manager : npm 10.8.2
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/animations │ 21.0.3 │ ^21.0.3 │
│ @angular/build │ 21.0.2 │ ^21.0.2 │
│ @angular/cli │ 21.0.2 │ ^21.0.2 │
│ @angular/common │ 21.0.3 │ ^21.0.3 │
│ @angular/compiler │ 21.0.3 │ ^21.0.3 │
│ @angular/compiler-cli │ 21.0.3 │ ^21.0.3 │
│ @angular/core │ 21.0.3 │ ^21.0.3 │
│ @angular/forms │ 21.0.3 │ ^21.0.3 │
│ @angular/platform-browser │ 21.0.3 │ ^21.0.3 │
│ @angular/router │ 21.0.3 │ ^21.0.3 │
│ rxjs │ 7.8.2 │ ^7.8.1 │
│ typescript │ 5.9.3 │ ^5.9.3 │
│ zone.js │ 0.16.0 │ ^0.16.0 │
└───────────────────────────┴───────────────────┴───────────────────┘
Anything else?
No response