Skip to content

Commit 0f07b25

Browse files
authored
fix(material/badge): resolve memory leak (#29676)
The badge had an extra unnecessary check which meant that it would sometimes leak memory through the style loader. This isn't a big deal on the client since there's usually only one app on the page, but it can be a problem on the server which can create and destroy an app for each request. Note that this is no longer an issue in 19.x where we use the common style loader, but we need to backport the fix to 18.x. Fixes angular/angular#57529.
1 parent 5d93395 commit 0f07b25

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/material/badge/badge.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,7 @@ export class MatBadge implements OnInit, OnDestroy {
173173

174174
appRef.onDestroy(() => {
175175
badgeApps.delete(appRef);
176-
if (badgeApps.size === 0) {
177-
componentRef.destroy();
178-
}
176+
componentRef.destroy();
179177
});
180178
}
181179

0 commit comments

Comments
 (0)