Skip to content

Commit 31419f6

Browse files
alan-agius4dylhunn
authored andcommittedJul 11, 2023
perf(platform-browser): do not remove renderer from cache when REMOVE_STYLES_ON_COMPONENT_DESTROY is enabled. (#51005)
Removing the renderer from cache is not needed when `REMOVE_STYLES_ON_COMPONENT_DESTROY` is enabled. This change retains the behaviour of keeping the renderer cached for the entire lifecycle of the application the same way it is done when `REMOVE_STYLES_ON_COMPONENT_DESTROY` is disabled. This seems to have be causing an increase in scripting. See: http://b/290666638 PR Close #51005
1 parent a4b0d29 commit 31419f6

File tree

1 file changed

+0
-8
lines changed

1 file changed

+0
-8
lines changed
 

‎packages/platform-browser/src/dom/dom_renderer.ts

-8
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export class DomRendererFactory2 implements RendererFactory2, OnDestroy {
132132
break;
133133
}
134134

135-
renderer.onDestroy = () => rendererByCompId.delete(type.id);
136135
rendererByCompId.set(type.id, renderer);
137136
}
138137

@@ -397,8 +396,6 @@ class ShadowDomRenderer extends DefaultDomRenderer2 {
397396

398397
class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
399398
private readonly styles: string[];
400-
private rendererUsageCount = 0;
401-
onDestroy: VoidFunction|undefined;
402399

403400
constructor(
404401
eventManager: EventManager,
@@ -416,7 +413,6 @@ class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
416413

417414
applyStyles(): void {
418415
this.sharedStylesHost.addStyles(this.styles);
419-
this.rendererUsageCount++;
420416
}
421417

422418
override destroy(): void {
@@ -425,10 +421,6 @@ class NoneEncapsulationDomRenderer extends DefaultDomRenderer2 {
425421
}
426422

427423
this.sharedStylesHost.removeStyles(this.styles);
428-
this.rendererUsageCount--;
429-
if (this.rendererUsageCount === 0) {
430-
this.onDestroy?.();
431-
}
432424
}
433425
}
434426

0 commit comments

Comments
 (0)
Please sign in to comment.